Changeset 672 in SHVCSoftware for branches/SHM-6-dev/source/Lib


Ignore:
Timestamp:
12 Apr 2014, 02:51:51 (11 years ago)
Author:
seregin
Message:

set default values for the syntax elements in particular addressing tickets #24 and #25

Location:
branches/SHM-6-dev/source/Lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.h

    r669 r672  
    684684  Bool       m_vpsVuiPresentFlag;
    685685#endif
     686  Bool       m_vpsExtensionFlag;
    686687
    687688#if O0164_MULTI_LAYER_HRD
     
    11311132
    11321133#if O0109_MOVE_VPS_VUI_FLAG
    1133   Bool   getVpsVuiPresentFlag()                                 { return m_vpsVuiPresentFlag; }
    1134   Void   setVpsVuiPresentFlag(Bool x)                           { m_vpsVuiPresentFlag = x; }
    1135 #endif
     1134  Bool   getVpsVuiPresentFlag()                        { return m_vpsVuiPresentFlag; }
     1135  Void   setVpsVuiPresentFlag(Bool x)                  { m_vpsVuiPresentFlag = x;    }
     1136#endif
     1137  Bool   getVpsExtensionFlag()                         { return m_vpsExtensionFlag;  }
     1138  Void   setVpsExtensionFlag(Bool x)                   { m_vpsExtensionFlag = x;     }
    11361139
    11371140#if !P0307_REMOVE_VPS_VUI_OFFSET
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r670 r672  
    977977    }
    978978  }
    979   READ_FLAG( uiCode,  "vps_extension_flag" );
    980   if (uiCode)
     979  READ_FLAG( uiCode,  "vps_extension_flag" );      pcVPS->setVpsExtensionFlag( uiCode ? true : false );
     980
     981  if( pcVPS->getVpsExtensionFlag()  )
    981982  {
    982983#if VPS_EXTNS
     
    10001001    }
    10011002#endif
     1003  }
     1004  else
     1005  {
     1006    // set default parameters when syntax elements are not present
     1007    defaultVPSExtension(pcVPS);   
    10021008  }
    10031009
     
    15011507  else
    15021508  {
    1503     // default assignment - each layer assigned each rep_format() structure in the order signaled
     1509    // When not present, the value of vps_rep_format_idx[ i ] is inferred to be equal to Min (i, vps_num_rep_formats_minus1)
    15041510    for(i = 1; i < vps->getMaxLayers(); i++)
    15051511    {
     
    16601666#if P0307_VPS_NON_VUI_EXTENSION
    16611667  READ_UVLC( uiCode,           "vps_non_vui_extension_length"); vps->setVpsNonVuiExtLength((Int)uiCode);
     1668
     1669  // The value of vps_non_vui_extension_length shall be in the range of 0 to 4096, inclusive.
     1670  assert( vps->getVpsNonVuiExtLength() >= 0 && vps->getVpsNonVuiExtLength() <= 4096 );
     1671
    16621672#if P0307_VPS_NON_VUI_EXT_UPDATE
    16631673  Int nonVuiExtByte = uiCode;
     
    17021712#endif
    17031713  }
    1704 }
    1705 #endif
     1714  else
     1715  {
     1716    // set default values for VPS VUI
     1717    defaultVPSVUI( vps );
     1718  }
     1719}
     1720
     1721Void TDecCavlc::defaultVPSExtension( TComVPS* vps )
     1722{
     1723  // set default parameters when they are not present
     1724  Int i, j;
     1725
     1726  // When layer_id_in_nuh[ i ] is not present, the value is inferred to be equal to i.
     1727  for(i = 0; i < vps->getMaxLayers(); i++)
     1728  {
     1729    vps->setLayerIdInNuh(i, i);
     1730    vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i);
     1731  }
     1732
     1733  // When not present, sub_layers_vps_max_minus1[ i ] is inferred to be equal to vps_max_sub_layers_minus1.
     1734  for( i = 0; i < vps->getMaxLayers(); i++)
     1735  {
     1736    vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
     1737  }
     1738
     1739  // When not present, max_tid_il_ref_pics_plus1[ i ][ j ] is inferred to be equal to 7.
     1740  for( i = 0; i < vps->getMaxLayers() - 1; i++ )
     1741  {
     1742#if O0225_MAX_TID_FOR_REF_LAYERS
     1743    for( j = i + 1; j < vps->getMaxLayers(); j++ )
     1744    {
     1745      vps->setMaxTidIlRefPicsPlus1(i, j, 7);
     1746    }
     1747#else
     1748    vps->setMaxTidIlRefPicsPlus1(i, 7);
     1749#endif
     1750  }
     1751 
     1752  // When not present, the value of num_add_output_layer_sets is inferred to be equal to 0.
     1753  // NumOutputLayerSets = num_add_output_layer_sets + vps_num_layer_sets_minus1 + 1
     1754  vps->setNumOutputLayerSets( vps->getNumLayerSets() );
     1755
     1756  // For i in the range of 0 to NumOutputLayerSets-1, inclusive, the variable LayerSetIdxForOutputLayerSet[ i ] is derived as specified in the following:
     1757  // LayerSetIdxForOutputLayerSet[ i ] = ( i <= vps_number_layer_sets_minus1 ) ? i : output_layer_set_idx_minus1[ i ] + 1
     1758  for( i = 1; i < vps->getNumOutputLayerSets(); i++ )
     1759  {
     1760    vps->setOutputLayerSetIdx( i, i );
     1761    Int lsIdx = vps->getOutputLayerSetIdx(i);
     1762
     1763    for( j = 0; j < vps->getNumLayersInIdList(lsIdx); j++ )
     1764    {
     1765    vps->setOutputLayerFlag(i, j, 1);
     1766    }
     1767  }
     1768
     1769  // The value of sub_layer_dpb_info_present_flag[ i ][ 0 ] for any possible value of i is inferred to be equal to 1
     1770  // When not present, the value of sub_layer_dpb_info_present_flag[ i ][ j ] for j greater than 0 and any possible value of i, is inferred to be equal to be equal to 0.
     1771  for( i = 1; i < vps->getNumOutputLayerSets(); i++ )
     1772  {
     1773    vps->setSubLayerDpbInfoPresentFlag( i, 0, true );
     1774  }
     1775 
     1776  // When not present, the value of vps_num_rep_formats_minus1 is inferred to be equal to MaxLayersMinus1.
     1777  vps->setVpsNumRepFormats( vps->getMaxLayers() );
     1778
     1779  // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0
     1780  vps->setRepFormatIdxPresentFlag( false );
     1781
     1782  if( !vps->getRepFormatIdxPresentFlag() )
     1783  {
     1784    // When not present, the value of vps_rep_format_idx[ i ] is inferred to be equal to Min(i, vps_num_rep_formats_minus1).
     1785    for(i = 1; i < vps->getMaxLayers(); i++)
     1786    {
     1787      vps->setVpsRepFormatIdx( i, min( (Int)i, vps->getVpsNumRepFormats() - 1 ) );
     1788    }
     1789  }
     1790
     1791  // vps_poc_lsb_aligned_flag
     1792  // When not present, vps_poc_lsb_aligned_flag is inferred to be equal to 0.
     1793 
     1794#if O0062_POC_LSB_NOT_PRESENT_FLAG
     1795  // When not present, poc_lsb_not_present_flag[ i ] is inferred to be equal to 0.
     1796  for(i = 1; i< vps->getMaxLayers(); i++)
     1797  {
     1798    vps->setPocLsbNotPresentFlag(i, 0);
     1799  }
     1800#endif
     1801
     1802  // set default values for VPS VUI
     1803  defaultVPSVUI( vps );
     1804}
     1805
     1806Void TDecCavlc::defaultVPSVUI( TComVPS* vps )
     1807{
     1808#if N0147_IRAP_ALIGN_FLAG
     1809  // When not present, the value of all_layers_idr_aligned_flag is inferred to be equal to 0.
     1810  vps->setCrossLayerIrapAlignFlag( false );
     1811#endif
     1812
     1813#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1814  // When single_layer_for_non_irap_flag is not present, it is inferred to be equal to 0.
     1815  vps->setSingleLayerForNonIrapFlag( false );
     1816#endif
     1817
     1818#if HIGHER_LAYER_IRAP_SKIP_FLAG
     1819  // When higher_layer_irap_skip_flag is not present it is inferred to be equal to 0
     1820  vps->setHigherLayerIrapSkipFlag( false );
     1821#endif
     1822}
     1823#endif
     1824
    17061825#if REPN_FORMAT_IN_VPS
    17071826Void  TDecCavlc::parseRepFormat( RepFormat *repFormat, RepFormat *repFormatPrev )
     
    17981917    READ_FLAG( uiCode, "sub_layer_flag_info_present_flag[i]");  vps->setSubLayerFlagInfoPresentFlag( i, uiCode ? true : false );
    17991918#if DPB_PARAMS_MAXTLAYERS
    1800       for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++)
     1919    for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++)
    18011920#else
    18021921    for(Int j = 0; j <= vps->getMaxTLayers(); j++)
     
    19182037        if( parseFlag && vps->getBitRatePresentVpsFlag() )
    19192038        {
    1920           READ_FLAG( uiCode,        "bit_rate_present_vps_flag[i][j]" );  vps->setBitRatePresentFlag( i, j, uiCode ? true : false );
     2039          READ_FLAG( uiCode,        "bit_rate_present_flag[i][j]" );  vps->setBitRatePresentFlag( i, j, uiCode ? true : false );
    19212040        }
    19222041        else
     
    19262045        if( parseFlag && vps->getPicRatePresentVpsFlag() )
    19272046        {
    1928           READ_FLAG( uiCode,        "pic_rate_present_vps_flag[i][j]" );  vps->setPicRatePresentFlag( i, j, uiCode ? true : false );
     2047          READ_FLAG( uiCode,        "pic_rate_present_flag[i][j]" );  vps->setPicRatePresentFlag( i, j, uiCode ? true : false );
    19292048        }
    19302049        else
     
    19662085    vps->setNumVideoSignalInfo(vps->getMaxLayers());
    19672086  }
    1968 
    19692087
    19702088  for(i = 0; i < vps->getNumVideoSignalInfo(); i++)
     
    20522170#if HIGHER_LAYER_IRAP_SKIP_FLAG
    20532171  READ_FLAG(uiCode, "higher_layer_irap_skip_flag" ); vps->setHigherLayerIrapSkipFlag(uiCode == 1 ? true : false);
     2172
     2173  // When single_layer_for_non_irap_flag is equal to 0, higher_layer_irap_skip_flag shall be equal to 0
     2174  if( !vps->getSingleLayerForNonIrapFlag() )
     2175  {
     2176    assert( !vps->getHigherLayerIrapSkipFlag() );
     2177  }
    20542178#endif
    20552179#endif
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.h

    r670 r672  
    7575#if VPS_EXTNS
    7676  Void  parseVPSExtension   ( TComVPS* pcVPS );
     77  Void  defaultVPSExtension ( TComVPS* pcVPS );
    7778#endif
    7879
    7980#if VPS_VUI
    8081  Void  parseVPSVUI   ( TComVPS* pcVPS );
     82  Void  defaultVPSVUI ( TComVPS* pcVPS );
    8183#endif
    8284#if REPN_FORMAT_IN_VPS
  • branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r665 r672  
    780780  WRITE_FLAG( 0,                     "vps_extension_flag" );
    781781#else
    782   WRITE_FLAG( 1,                     "vps_extension_flag" );
    783   if(1) // Should be conditioned on the value of vps_extension_flag
     782  pcVPS->setVpsExtensionFlag(true);
     783  WRITE_FLAG( pcVPS->getVpsExtensionFlag() ? 1 : 0,                     "vps_extension_flag" );
     784
     785  if( pcVPS->getVpsExtensionFlag() )
    784786  {
    785787    while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )
     
    12401242
    12411243#if P0307_VPS_NON_VUI_EXTENSION
     1244  // The value of vps_non_vui_extension_length shall be in the range of 0 to 4096, inclusive.
     1245  assert( vps->getVpsNonVuiExtLength() >= 0 && vps->getVpsNonVuiExtLength() <= 4096 );
     1246
    12421247  WRITE_UVLC( vps->getVpsNonVuiExtLength(), "vps_non_vui_extension_length" );
    12431248#if P0307_VPS_NON_VUI_EXT_UPDATE
     
    12751280#else
    12761281#if P0307_REMOVE_VPS_VUI_OFFSET
    1277   WRITE_FLAG( 1,                     "vps_vui_present_flag" );
    12781282  vps->setVpsVuiPresentFlag(true);
     1283  WRITE_FLAG( vps->getVpsVuiPresentFlag() ? 1 : 0,                     "vps_vui_present_flag" );
    12791284#endif
    12801285  if(vps->getVpsVuiPresentFlag())   // Should be conditioned on the value of vps_vui_present_flag
     
    14321437        if( vps->getBitRatePresentVpsFlag() )
    14331438        {
    1434           WRITE_FLAG( vps->getBitRatePresentFlag( i, j),        "bit_rate_present_vps_flag[i][j]" );
     1439          WRITE_FLAG( vps->getBitRatePresentFlag( i, j),        "bit_rate_present_flag[i][j]" );
    14351440        }
    14361441        if( vps->getPicRatePresentVpsFlag() )
    14371442        {
    1438           WRITE_FLAG( vps->getPicRatePresentFlag( i, j),        "pic_rate_present_vps_flag[i][j]" );
     1443          WRITE_FLAG( vps->getPicRatePresentFlag( i, j),        "pic_rate_present_flag[i][j]" );
    14391444        }
    14401445        if( vps->getBitRatePresentFlag(i, j) )
     
    15231528#endif
    15241529#if HIGHER_LAYER_IRAP_SKIP_FLAG
     1530  // When single_layer_for_non_irap_flag is equal to 0, higher_layer_irap_skip_flag shall be equal to 0
     1531  if( !vps->getSingleLayerForNonIrapFlag() )
     1532  {
     1533    assert( !vps->getHigherLayerIrapSkipFlag() );
     1534  }
     1535
    15251536  WRITE_FLAG(vps->getHigherLayerIrapSkipFlag(), "higher_layer_irap_skip_flag" );
    15261537#endif
Note: See TracChangeset for help on using the changeset viewer.