Changeset 389 in SHVCSoftware for branches/SHM-3.1-dev/source/Lib/TLibCommon


Ignore:
Timestamp:
10 Sep 2013, 17:27:55 (11 years ago)
Author:
qualcomm
Message:

Signaling representation format in VPS (MACRO: REPN_FORMAT_IN_VPS)

Includes signaling of representation format - including picture resolution, bit depth, chroma format - in the VPS, with the option of updating them in the SPS. The configuration file has "RepFormatIdx%d" added to indicate for each layer which representation format is used. The rep_format() structures are automatically created by the encoder. If the bit depth and the chroma format are also changed across layers, some more configuration support would be needed.

From: Adarsh K. Ramasubramonian <aramasub@…>

Location:
branches/SHM-3.1-dev/source/Lib/TLibCommon
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r378 r389  
    12731273  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    12741274 
     1275#if REPN_FORMAT_IN_VPS
     1276  if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getPicWidthInLumaSamples() )
     1277#else
    12751278  if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
     1279#endif
    12761280  {
    12771281    uiARPartUnitIdx = MAX_UINT;
     
    13351339  UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[ m_uiAbsIdxInLCU ] + (m_puhHeight[0] / m_pcPic->getMinCUHeight() - 1)*m_pcPic->getNumPartInWidth();
    13361340  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    1337  
     1341
     1342#if REPN_FORMAT_IN_VPS
     1343  if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getPicHeightInLumaSamples() )
     1344#else
    13381345  if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     1346#endif
    13391347  {
    13401348    uiBLPartUnitIdx = MAX_UINT;
     
    13841392  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    13851393 
     1394#if REPN_FORMAT_IN_VPS
     1395  if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getPicHeightInLumaSamples())
     1396#else
    13861397  if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples())
     1398#endif
    13871399  {
    13881400    uiBLPartUnitIdx = MAX_UINT;
     
    14321444  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    14331445 
     1446#if REPN_FORMAT_IN_VPS
     1447  if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getPicWidthInLumaSamples() )
     1448#else
    14341449  if( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
     1450#endif
    14351451  {
    14361452    uiARPartUnitIdx = MAX_UINT;
     
    26842700    Int uiLCUIdx = -1;
    26852701
     2702#if REPN_FORMAT_IN_VPS
     2703    if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getPicWidthInLumaSamples() )  // image boundary check
     2704    {
     2705    }
     2706    else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getPicHeightInLumaSamples() )
     2707    {
     2708    }
     2709#else
    26862710    if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
    26872711    {
     
    26902714    {
    26912715    }
     2716#endif
    26922717    else
    26932718    {
     
    30203045    uiAbsPartIdx = g_auiZscanToRaster[uiPartIdxRB];
    30213046    Int uiLCUIdx = -1;
     3047#if REPN_FORMAT_IN_VPS
     3048    if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getPicWidthInLumaSamples() )  // image boundary check
     3049    {
     3050    }
     3051    else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdx] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getPicHeightInLumaSamples() )
     3052    {
     3053    }
     3054#else
    30223055    if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdx] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
    30233056    {
     
    30263059    {
    30273060    }
     3061#endif
    30283062    else
    30293063    {
     
    30953129  Int  iMvShift = 2;
    30963130  Int iOffset = 8;
     3131#if REPN_FORMAT_IN_VPS
     3132  Int iHorMax = ( m_pcSlice->getPicWidthInLumaSamples() + iOffset - m_uiCUPelX - 1 ) << iMvShift;
     3133#else
    30973134  Int iHorMax = ( m_pcSlice->getSPS()->getPicWidthInLumaSamples() + iOffset - m_uiCUPelX - 1 ) << iMvShift;
     3135#endif
    30983136  Int iHorMin = (       -(Int)g_uiMaxCUWidth - iOffset - (Int)m_uiCUPelX + 1 ) << iMvShift;
    30993137 
     3138#if REPN_FORMAT_IN_VPS
     3139  Int iVerMax = ( m_pcSlice->getPicHeightInLumaSamples() + iOffset - m_uiCUPelY - 1 ) << iMvShift;
     3140#else
    31003141  Int iVerMax = ( m_pcSlice->getSPS()->getPicHeightInLumaSamples() + iOffset - m_uiCUPelY - 1 ) << iMvShift;
     3142#endif
    31013143  Int iVerMin = (       -(Int)g_uiMaxCUHeight - iOffset - (Int)m_uiCUPelY + 1 ) << iMvShift;
    31023144 
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TComLoopFilter.cpp

    r313 r389  
    180180      UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsZorderIdx] ];
    181181      UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsZorderIdx] ];
     182#if REPN_FORMAT_IN_VPS
     183      if( ( uiLPelX < pcCU->getSlice()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getPicHeightInLumaSamples() ) )
     184#else
    182185      if( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
     186#endif
    183187      {
    184188        xDeblockCU( pcCU, uiAbsZorderIdx, uiDepth+1, Edge );
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TComPic.cpp

    r377 r389  
    213213  UInt maxNumSUInLCU = getNumPartInCU();
    214214  UInt numLCUInPic   = getNumCUsInFrame();
     215#if REPN_FORMAT_IN_VPS
     216  UInt picWidth      = getSlice(0)->getPicWidthInLumaSamples();
     217  UInt picHeight     = getSlice(0)->getPicHeightInLumaSamples();
     218#else
    215219  UInt picWidth      = getSlice(0)->getSPS()->getPicWidthInLumaSamples();
    216220  UInt picHeight     = getSlice(0)->getSPS()->getPicHeightInLumaSamples();
     221#endif
    217222  Int  numLCUsInPicWidth = getFrameWidthInCU();
    218223  Int  numLCUsInPicHeight= getFrameHeightInCU();
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp

    r313 r389  
    14141414      UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsZorderIdx] ];
    14151415      UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsZorderIdx] ];
     1416#if REPN_FORMAT_IN_VPS
     1417      if( ( uiLPelX < pcCU->getSlice()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getPicHeightInLumaSamples() ) )
     1418#else
    14161419      if( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
     1420#endif
    14171421        xPCMCURestoration( pcCU, uiAbsZorderIdx, uiDepth+1 );
    14181422    }
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.cpp

    r387 r389  
    15871587}
    15881588
     1589#if REPN_FORMAT_IN_VPS
     1590UInt TComSlice::getPicWidthInLumaSamples()
     1591{
     1592  TComSPS *sps = getSPS();
     1593  TComVPS *vps = getVPS();
     1594  UInt retVal, layerId = getLayerId();
     1595  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
     1596  {
     1597    retVal = sps->getPicWidthInLumaSamples();
     1598  }
     1599  else
     1600  {
     1601    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getPicWidthVpsInLumaSamples();
     1602  }
     1603  return retVal;
     1604}
     1605UInt TComSlice::getPicHeightInLumaSamples()
     1606{
     1607  TComSPS *sps = getSPS();
     1608  TComVPS *vps = getVPS();
     1609  UInt retVal, layerId = getLayerId();
     1610  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
     1611  {
     1612    retVal = sps->getPicHeightInLumaSamples();
     1613  }
     1614  else
     1615  {
     1616    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getPicHeightVpsInLumaSamples();
     1617  }
     1618  return retVal;
     1619}
     1620UInt TComSlice::getChromaFormatIdc()
     1621{
     1622  TComSPS *sps = getSPS();
     1623  TComVPS *vps = getVPS();
     1624  UInt retVal, layerId = getLayerId();
     1625  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
     1626  {
     1627    retVal = sps->getChromaFormatIdc();
     1628  }
     1629  else
     1630  {
     1631    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc();
     1632  }
     1633  return retVal;
     1634}
     1635UInt TComSlice::getBitDepthY()
     1636{
     1637  TComSPS *sps = getSPS();
     1638  TComVPS *vps = getVPS();
     1639  UInt retVal, layerId = getLayerId();
     1640  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
     1641  {
     1642    retVal = sps->getBitDepthY();
     1643  }
     1644  else
     1645  {
     1646    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma();
     1647  }
     1648  return retVal;
     1649}
     1650UInt TComSlice::getBitDepthC()
     1651{
     1652  TComSPS *sps = getSPS();
     1653  TComVPS *vps = getVPS();
     1654  UInt retVal, layerId = getLayerId();
     1655  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
     1656  {
     1657    retVal = sps->getBitDepthC();
     1658  }
     1659  else
     1660  {
     1661    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma();
     1662  }
     1663  return retVal;
     1664}
     1665Int TComSlice::getQpBDOffsetY()
     1666{
     1667  return (getBitDepthY() - 8) * 6;
     1668}
     1669Int TComSlice::getQpBDOffsetC()
     1670{
     1671  return (getBitDepthC() - 8) * 6;
     1672}
     1673
     1674RepFormat::RepFormat()
     1675: m_chromaFormatVpsIdc          (0)
     1676, m_separateColourPlaneVpsFlag  (false)
     1677, m_picWidthVpsInLumaSamples    (0)
     1678, m_picHeightVpsInLumaSamples   (0)
     1679, m_bitDepthVpsLuma             (0)
     1680, m_bitDepthVpsChroma           (0)
     1681{}
     1682#endif
     1683
    15891684// ------------------------------------------------------------------------------------------------
    15901685// Video parameter set (VPS)
     
    16191714, m_picRatePresentVpsFlag     (false)
    16201715#endif
     1716#if REPN_FORMAT_IN_VPS
     1717, m_repFormatIdxPresentFlag   (true)
     1718, m_vpsNumRepFormats          (1)
     1719#endif
    16211720{
    16221721  for( Int i = 0; i < MAX_TLAYER; i++)
     
    16921791  ::memset(m_constPicRateIdc   , 0, sizeof(m_constPicRateIdc)   );
    16931792  ::memset(m_avgPicRate        , 0, sizeof(m_avgPicRate)        );
     1793#endif
     1794#if REPN_FORMAT_IN_VPS
     1795  ::memset( m_vpsRepFormatIdx, 0, sizeof(m_vpsRepFormatIdx) );
    16941796#endif
    16951797}
     
    17781880, m_numScaledRefLayerOffsets  (0)
    17791881#endif
     1882#if REPN_FORMAT_IN_VPS
     1883, m_updateRepFormatFlag       (false)
     1884#endif
    17801885{
    17811886  for ( Int i = 0; i < MAX_TLAYER; i++ )
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.h

    r386 r389  
    406406};
    407407
     408#if REPN_FORMAT_IN_VPS
     409class RepFormat
     410{
     411  Int  m_chromaFormatVpsIdc;
     412  Bool m_separateColourPlaneVpsFlag;
     413  Int  m_picWidthVpsInLumaSamples;
     414  Int  m_picHeightVpsInLumaSamples;
     415  Int  m_bitDepthVpsLuma;               // coded as minus8
     416  Int  m_bitDepthVpsChroma;             // coded as minus8
     417
     418public:
     419  RepFormat();
     420
     421  Int  getChromaFormatVpsIdc()        { return m_chromaFormatVpsIdc; }
     422  Void setChromaFormatVpsIdc(Int x)   { m_chromaFormatVpsIdc = x;    }
     423
     424  Bool getSeparateColourPlaneVpsFlag()        { return m_separateColourPlaneVpsFlag; }
     425  Void setSeparateColourPlaneVpsFlag(Bool x)  { m_separateColourPlaneVpsFlag = x;    }
     426
     427  Int  getPicWidthVpsInLumaSamples()        { return m_picWidthVpsInLumaSamples; }
     428  Void setPicWidthVpsInLumaSamples(Int x)   { m_picWidthVpsInLumaSamples = x;    }
     429
     430  Int  getPicHeightVpsInLumaSamples()        { return m_picHeightVpsInLumaSamples; }
     431  Void setPicHeightVpsInLumaSamples(Int x)   { m_picHeightVpsInLumaSamples = x;    }
     432
     433  Int  getBitDepthVpsLuma()           { return m_bitDepthVpsLuma;   }
     434  Void setBitDepthVpsLuma(Int x)      { m_bitDepthVpsLuma = x;      }
     435
     436  Int  getBitDepthVpsChroma()           { return m_bitDepthVpsChroma;   }
     437  Void setBitDepthVpsChroma(Int x)      { m_bitDepthVpsChroma = x;      }
     438};
     439#endif
    408440class TComVPS
    409441{
     
    519551  Int         m_avgPicRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
    520552#endif
     553#if REPN_FORMAT_IN_VPS
     554  Bool       m_repFormatIdxPresentFlag;
     555  Int        m_vpsNumRepFormats;            // coded as minus1
     556  RepFormat  m_vpsRepFormat[16];
     557  Int        m_vpsRepFormatIdx[16];
     558#endif
    521559public:
    522560  TComVPS();
     
    727765  Int  getAvgPicRate(Int i, Int j)          { return m_avgPicRate[i][j]; }
    728766  Void setAvgPicRate(Int i, Int j, Int x)   { m_avgPicRate[i][j] = x;    }
     767#endif
     768
     769#if REPN_FORMAT_IN_VPS
     770  Bool   getRepFormatIdxPresentFlag()       { return m_repFormatIdxPresentFlag; }
     771  Void   setRepFormatIdxPresentFlag(Bool x) { m_repFormatIdxPresentFlag = x;    }
     772
     773  Int    getVpsNumRepFormats()              { return m_vpsNumRepFormats;        }
     774  Void   setVpsNumRepFormats(Int x)         { m_vpsNumRepFormats = x;           }
     775
     776  RepFormat* getVpsRepFormat(Int idx)       { return &m_vpsRepFormat[idx];      }
     777
     778  Int    getVpsRepFormatIdx(Int idx)        { return m_vpsRepFormatIdx[idx];   }
     779  Void   setVpsRepFormatIdx(Int idx, Int x) { m_vpsRepFormatIdx[idx] = x;      }         
    729780#endif
    730781};
     
    10411092  UInt        m_numScaledRefLayerOffsets;
    10421093  Window      m_scaledRefLayerWindow[MAX_LAYERS];
     1094#endif
     1095#if REPN_FORMAT_IN_VPS
     1096  Bool m_updateRepFormatFlag;
    10431097#endif
    10441098public:
     
    12001254  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
    12011255#endif
     1256#if REPN_FORMAT_IN_VPS
     1257  Bool     getUpdateRepFormatFlag()       { return m_updateRepFormatFlag; }
     1258  Void     setUpdateRepFormatFlag(Bool x) { m_updateRepFormatFlag = x;    }
     1259#endif
    12021260};
    12031261
     
    18661924#endif //SVC_EXTENSION
    18671925
     1926#if REPN_FORMAT_IN_VPS
     1927  UInt getPicWidthInLumaSamples();
     1928  UInt getPicHeightInLumaSamples();
     1929  UInt getChromaFormatIdc();
     1930  UInt getBitDepthY();
     1931  UInt getBitDepthC();
     1932  Int getQpBDOffsetY();
     1933  Int getQpBDOffsetC();
     1934#endif
    18681935protected:
    18691936  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TComTrQuant.cpp

    r345 r389  
    4242#include "TComPic.h"
    4343#include "ContextTables.h"
    44 
     44#define MAYBE_BUGFIX 1
    4545typedef struct
    4646{
     
    5050  Double d64SigCost;
    5151  Double d64SigCost_0;
     52#if MAYBE_BUGFIX
     53  Void init()
     54  {
     55    iNNZbeforePos0 = 0;
     56  d64CodedLevelandDist = 0;
     57  d64UncodedDist = 0;
     58  d64SigCost = 0;
     59  d64SigCost_0 = 0;
     60  }
     61#endif
    5262} coeffGroupRDStats;
    5363
     
    10331043
    10341044    Int qpScaled;
     1045#if REPN_FORMAT_IN_VPS
     1046    Int qpBDOffset = (eTType == TEXT_LUMA)? pcCU->getSlice()->getQpBDOffsetY() : pcCU->getSlice()->getQpBDOffsetC();
     1047#else
    10351048    Int qpBDOffset = (eTType == TEXT_LUMA)? pcCU->getSlice()->getSPS()->getQpBDOffsetY() : pcCU->getSlice()->getSPS()->getQpBDOffsetC();
     1049#endif
    10361050
    10371051    if(eTType == TEXT_LUMA)
     
    15811595    UInt uiCGPosY   = uiCGBlkPos / uiNumBlkSide;
    15821596    UInt uiCGPosX   = uiCGBlkPos - (uiCGPosY * uiNumBlkSide);
     1597#if MAYBE_BUGFIX
     1598    rdStats.init();
     1599#else
    15831600    ::memset( &rdStats, 0, sizeof (coeffGroupRDStats));
    1584    
     1601#endif
    15851602    const Int patternSigCtx = TComTrQuant::calcPatternSigCtx(uiSigCoeffGroupFlag, uiCGPosX, uiCGPosY, uiWidth, uiHeight);
    15861603    for (Int iScanPosinCG = uiCGSize-1; iScanPosinCG >= 0; iScanPosinCG--)
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TypeDef.h

    r386 r389  
    4848#if SVC_EXTENSION
    4949#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     50#define REPN_FORMAT_IN_VPS               1      ///< N0092: Signal represenation format (spatial resolution, bit depth, colour format) in the VPS
    5051#define TIMING_INFO_NONZERO_LAYERID_SPS  1      ///< N0085: Semantics of vui_timing_info_present_flag to always set that flag to zero for non-zero layer ID SPS
    5152#define RPL_INIT_N0316_N0082             1      ///< N0316, N0082: initial reference picture list construction
Note: See TracChangeset for help on using the changeset viewer.