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


Ignore:
Timestamp:
7 Apr 2014, 23:08:52 (12 years ago)
Author:
seregin
Message:

update to HM-14.0

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

Legend:

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

    r644 r652  
    6060#define NV_VERSION        "5.1 (HM-13.0)"                 ///< Current software version
    6161#else
    62 #define NV_VERSION        "13.0"                ///< Current software version
     62#define NV_VERSION        "14.0"                ///< Current software version
    6363#endif
    6464
  • branches/SHM-6-dev/source/Lib/TLibCommon/SEI.h

    r644 r652  
    142142  SEIActiveParameterSets()
    143143    : activeVPSId            (0)
    144     , m_fullRandomAccessFlag (false)
    145     , m_noParamSetUpdateFlag (false)
     144    , m_selfContainedCvsFlag (false)
     145    , m_noParameterSetUpdateFlag (false)
    146146    , numSpsIdsMinus1        (0)
    147147  {}
     
    149149
    150150  Int activeVPSId;
    151   Bool m_fullRandomAccessFlag;
    152   Bool m_noParamSetUpdateFlag;
     151  Bool m_selfContainedCvsFlag;
     152  Bool m_noParameterSetUpdateFlag;
    153153  Int numSpsIdsMinus1;
    154   std::vector<Int> activeSeqParamSetId;
     154  std::vector<Int> activeSeqParameterSetId;
    155155};
    156156
     
    393393  Int    m_cameraIsoSpeedIdc;
    394394  Int    m_cameraIsoSpeedValue;
     395  Int    m_exposureIndexIdc;
     396  Int    m_exposureIndexValue;
    395397  Int    m_exposureCompensationValueSignFlag;
    396398  Int    m_exposureCompensationValueNumerator;
  • branches/SHM-6-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r595 r652  
    16901690}
    16911691
    1692 
    1693 #if FAST_INTRA_SHVC
    1694 /** generate limited set of remaining modes
    1695 *\param   uiAbsPartIdx
    1696 *\param   uiIntraDirPred  pointer to the array for MPM storage
    1697 *\returns Number of intra coding modes (nb of remaining modes + 3 MPMs)
    1698 */
    1699 Int TComDataCU::reduceSetOfIntraModes( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int &fullSetOfModes )
    1700 {
    1701   // check BL mode
    1702   UInt          uiCUAddrBase = 0, uiAbsPartAddrBase = 0;
    1703   // the right reference layerIdc should be specified, currently it is set to m_layerId-1
    1704   TComDataCU*   pcTempCU = getBaseColCU(m_layerId - 1, uiAbsPartIdx, uiCUAddrBase, uiAbsPartAddrBase, 0 );
    1705 
    1706   if( pcTempCU->getPredictionMode( uiAbsPartAddrBase ) != MODE_INTRA )
    1707   {
    1708     return( NUM_INTRA_MODE-1 );
    1709   }
    1710 
    1711   // compute set of enabled modes g_reducedSetIntraModes[...]
    1712   Int authorizedMode[NUM_INTRA_MODE-1]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
    1713   Int nbModes;
    1714   for (nbModes=0; nbModes<3; nbModes++)  // add 3 MPMs 1st
    1715   {
    1716     g_reducedSetIntraModes[nbModes] = uiIntraDirPred[nbModes];
    1717     authorizedMode[ uiIntraDirPred[nbModes] ] = 0;
    1718   }
    1719 
    1720   Int iColBaseDir = pcTempCU->getLumaIntraDir( uiAbsPartAddrBase );
    1721   if ( authorizedMode[iColBaseDir] )  //possibly add BL mode
    1722   {
    1723     g_reducedSetIntraModes[nbModes++] = iColBaseDir;
    1724     authorizedMode[ iColBaseDir ] = 0;
    1725   }
    1726 
    1727   Int iRefMode = ( iColBaseDir > 1 ) ? iColBaseDir : uiIntraDirPred[0];
    1728   if ( iRefMode > 1 )    //add neighboring modes of refMode
    1729   {
    1730     UInt Left  = iRefMode;
    1731     UInt Right = iRefMode;
    1732     while ( nbModes < NB_REMAIN_MODES+3 )
    1733     {
    1734       Left = ((Left + 29) % 32) + 2;
    1735       Right = ((Right - 1 ) % 32) + 2;
    1736       if ( authorizedMode[Left] )   g_reducedSetIntraModes[nbModes++] = Left;
    1737       if ( authorizedMode[Right] )  g_reducedSetIntraModes[nbModes++] = Right;
    1738     }
    1739   }
    1740   else      //add pre-defined modes
    1741   {
    1742     Int  idx = 0;
    1743     while ( nbModes < NB_REMAIN_MODES+3 )
    1744     {
    1745       UInt mode = g_predefSetIntraModes[idx++];
    1746       if ( authorizedMode[mode] )   g_reducedSetIntraModes[nbModes++] = mode;
    1747     }
    1748   }
    1749 
    1750   fullSetOfModes = 0;
    1751   return ( nbModes );
    1752 }
    1753 #endif
    1754 
    1755 
    17561692UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth )
    17571693{
     
    18091745  return log2MinTUSizeInCU;
    18101746}
    1811 
    1812 #if REF_IDX_ME_ZEROMV
    1813 Bool TComDataCU::xCheckZeroMVILRMerge(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1)
    1814 {
    1815   Bool checkZeroMVILR = true;
    1816 
    1817   if(uhInterDir&0x1)  //list0
    1818   {
    1819     Int refIdxL0 = cMvFieldL0.getRefIdx();
    1820     if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR(m_layerId))
    1821     {
    1822       checkZeroMVILR &= (cMvFieldL0.getHor() == 0 && cMvFieldL0.getVer() == 0);
    1823     }
    1824   }
    1825   if(uhInterDir&0x2)  //list1
    1826   {
    1827     Int refIdxL1  = cMvFieldL1.getRefIdx();
    1828     if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR(m_layerId))
    1829     {
    1830       checkZeroMVILR &= (cMvFieldL1.getHor() == 0 && cMvFieldL1.getVer() == 0);
    1831     }
    1832   }
    1833 
    1834   return checkZeroMVILR;
    1835 }
    1836 
    1837 Bool TComDataCU::xCheckZeroMVILRMvdL1Zero(Int iRefList, Int iRefIdx, Int MvpIdx)
    1838 {
    1839   RefPicList eRefPicList = iRefList > 0? REF_PIC_LIST_1: REF_PIC_LIST_0;
    1840   assert(eRefPicList == REF_PIC_LIST_1);
    1841 
    1842   Bool checkZeroMVILR = true;
    1843 
    1844   if(getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(m_layerId))
    1845   {
    1846     AMVPInfo* pcAMVPInfo = getCUMvField(eRefPicList)->getAMVPInfo();
    1847     TComMv    cMv        = pcAMVPInfo->m_acMvCand[MvpIdx];
    1848     checkZeroMVILR &= (cMv.getHor() == 0 && cMv.getVer() == 0);
    1849   }
    1850 
    1851   return checkZeroMVILR;
    1852 }
    1853 #endif
    1854 
    1855 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    1856 Bool TComDataCU::isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1)
    1857 {
    1858   Bool checkILR = false;
    1859 
    1860   if(uhInterDir&0x1)  //list0
    1861   {
    1862     Int refIdxL0 = cMvFieldL0.getRefIdx();
    1863     checkILR = getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR(m_layerId);
    1864   }
    1865   if(uhInterDir&0x2)  //list1
    1866   {
    1867     Int refIdxL1  = cMvFieldL1.getRefIdx();
    1868     checkILR = checkILR || getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR(m_layerId);
    1869   }
    1870 
    1871   return checkILR;
    1872 }
    1873 #endif
    18741747
    18751748UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx )
     
    21682041}
    21692042
    2170 UChar TComDataCU::getNumPartInter()
     2043UChar TComDataCU::getNumPartitions()
    21712044{
    21722045  UChar iNumPart = 0;
     
    36803553  rcMvFieldEnhance.setMvField( cMv, rcMvFieldBase.getRefIdx() );
    36813554}
     3555
     3556#if FAST_INTRA_SHVC
     3557/** generate limited set of remaining modes
     3558*\param   uiAbsPartIdx
     3559*\param   uiIntraDirPred  pointer to the array for MPM storage
     3560*\returns Number of intra coding modes (nb of remaining modes + 3 MPMs)
     3561*/
     3562Int TComDataCU::reduceSetOfIntraModes( UInt uiAbsPartIdx, Int* uiIntraDirPred, Int &fullSetOfModes )
     3563{
     3564  // check BL mode
     3565  UInt          uiCUAddrBase = 0, uiAbsPartAddrBase = 0;
     3566  // the right reference layerIdc should be specified, currently it is set to m_layerId-1
     3567  TComDataCU*   pcTempCU = getBaseColCU(m_layerId - 1, uiAbsPartIdx, uiCUAddrBase, uiAbsPartAddrBase, 0 );
     3568
     3569  if( pcTempCU->getPredictionMode( uiAbsPartAddrBase ) != MODE_INTRA )
     3570  {
     3571    return( NUM_INTRA_MODE-1 );
     3572  }
     3573
     3574  // compute set of enabled modes g_reducedSetIntraModes[...]
     3575  Int authorizedMode[NUM_INTRA_MODE-1]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
     3576  Int nbModes;
     3577  for (nbModes=0; nbModes<3; nbModes++)  // add 3 MPMs 1st
     3578  {
     3579    g_reducedSetIntraModes[nbModes] = uiIntraDirPred[nbModes];
     3580    authorizedMode[ uiIntraDirPred[nbModes] ] = 0;
     3581  }
     3582
     3583  Int iColBaseDir = pcTempCU->getLumaIntraDir( uiAbsPartAddrBase );
     3584  if ( authorizedMode[iColBaseDir] )  //possibly add BL mode
     3585  {
     3586    g_reducedSetIntraModes[nbModes++] = iColBaseDir;
     3587    authorizedMode[ iColBaseDir ] = 0;
     3588  }
     3589
     3590  Int iRefMode = ( iColBaseDir > 1 ) ? iColBaseDir : uiIntraDirPred[0];
     3591  if ( iRefMode > 1 )    //add neighboring modes of refMode
     3592  {
     3593    UInt Left  = iRefMode;
     3594    UInt Right = iRefMode;
     3595    while ( nbModes < NB_REMAIN_MODES+3 )
     3596    {
     3597      Left = ((Left + 29) % 32) + 2;
     3598      Right = ((Right - 1 ) % 32) + 2;
     3599      if ( authorizedMode[Left] )   g_reducedSetIntraModes[nbModes++] = Left;
     3600      if ( authorizedMode[Right] )  g_reducedSetIntraModes[nbModes++] = Right;
     3601    }
     3602  }
     3603  else      //add pre-defined modes
     3604  {
     3605    Int  idx = 0;
     3606    while ( nbModes < NB_REMAIN_MODES+3 )
     3607    {
     3608      UInt mode = g_predefSetIntraModes[idx++];
     3609      if ( authorizedMode[mode] )   g_reducedSetIntraModes[nbModes++] = mode;
     3610    }
     3611  }
     3612
     3613  fullSetOfModes = 0;
     3614  return ( nbModes );
     3615}
     3616#endif
     3617
     3618#if REF_IDX_ME_ZEROMV
     3619Bool TComDataCU::xCheckZeroMVILRMerge(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1)
     3620{
     3621  Bool checkZeroMVILR = true;
     3622
     3623  if(uhInterDir&0x1)  //list0
     3624  {
     3625    Int refIdxL0 = cMvFieldL0.getRefIdx();
     3626    if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR(m_layerId))
     3627    {
     3628      checkZeroMVILR &= (cMvFieldL0.getHor() == 0 && cMvFieldL0.getVer() == 0);
     3629    }
     3630  }
     3631  if(uhInterDir&0x2)  //list1
     3632  {
     3633    Int refIdxL1  = cMvFieldL1.getRefIdx();
     3634    if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR(m_layerId))
     3635    {
     3636      checkZeroMVILR &= (cMvFieldL1.getHor() == 0 && cMvFieldL1.getVer() == 0);
     3637    }
     3638  }
     3639
     3640  return checkZeroMVILR;
     3641}
     3642
     3643Bool TComDataCU::xCheckZeroMVILRMvdL1Zero(Int iRefList, Int iRefIdx, Int MvpIdx)
     3644{
     3645  RefPicList eRefPicList = iRefList > 0? REF_PIC_LIST_1: REF_PIC_LIST_0;
     3646  assert(eRefPicList == REF_PIC_LIST_1);
     3647
     3648  Bool checkZeroMVILR = true;
     3649
     3650  if(getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(m_layerId))
     3651  {
     3652    AMVPInfo* pcAMVPInfo = getCUMvField(eRefPicList)->getAMVPInfo();
     3653    TComMv    cMv        = pcAMVPInfo->m_acMvCand[MvpIdx];
     3654    checkZeroMVILR &= (cMv.getHor() == 0 && cMv.getVer() == 0);
     3655  }
     3656
     3657  return checkZeroMVILR;
     3658}
     3659#endif
     3660
     3661#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3662Bool TComDataCU::isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1)
     3663{
     3664  Bool checkILR = false;
     3665
     3666  if(uhInterDir&0x1)  //list0
     3667  {
     3668    Int refIdxL0 = cMvFieldL0.getRefIdx();
     3669    checkILR = getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR(m_layerId);
     3670  }
     3671  if(uhInterDir&0x2)  //list1
     3672  {
     3673    Int refIdxL1  = cMvFieldL1.getRefIdx();
     3674    checkILR = checkILR || getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR(m_layerId);
     3675  }
     3676
     3677  return checkILR;
     3678}
     3679#endif
     3680
    36823681#endif //SVC_EXTENSION
    36833682//! \}
  • branches/SHM-6-dev/source/Lib/TLibCommon/TComDataCU.h

    r595 r652  
    352352 
    353353  Void          getPartIndexAndSize   ( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight );
    354   UChar         getNumPartInter       ();
     354  UChar         getNumPartitions       ();
    355355  Bool          isFirstAbsZorderIdxInDepth (UInt uiAbsPartIdx, UInt uiDepth);
    356356 
  • branches/SHM-6-dev/source/Lib/TLibCommon/TComMotionInfo.h

    r595 r652  
    141141  Void    setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
    142142
    143 #if AVC_SYNTAX
    144   Void           setMv    (TComMv cMv,  Int iIdx )         { m_pcMv    [iIdx] = cMv; }
    145   Void           setRefIdx(Int iRefIdx, Int iIdx   )       { m_piRefIdx[iIdx] =  iRefIdx; }
    146 #endif
    147 
    148143  Void setNumPartition( Int iNumPart )
    149144  {
     
    159154 
    160155  Void compress(Char* pePredMode, Int scale);
     156
     157#if AVC_SYNTAX
     158  Void           setMv    (TComMv cMv,  Int iIdx )         { m_pcMv    [iIdx] = cMv; }
     159  Void           setRefIdx(Int iRefIdx, Int iIdx   )       { m_piRefIdx[iIdx] =  iRefIdx; }
     160#endif
    161161
    162162#if REF_IDX_MFM
  • branches/SHM-6-dev/source/Lib/TLibCommon/TComPic.h

    r595 r652  
    115115  UInt          getTLayer()                { return m_uiTLayer;   }
    116116  Void          setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; }
     117
    117118  Bool          getUsedByCurr()             { return m_bUsedByCurr; }
    118119  Void          setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; }
  • branches/SHM-6-dev/source/Lib/TLibCommon/TComPrediction.cpp

    r644 r652  
    447447  }
    448448
    449   for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartInter(); iPartIdx++ )
     449  for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartitions(); iPartIdx++ )
    450450  {
    451451    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
  • branches/SHM-6-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp

    r644 r652  
    112112    m_offsetClipTable[compIdx] = NULL;
    113113  }
     114#if !SAO_SGN_FUNC
    114115  m_signTable = NULL;
    115 
     116#endif
    116117 
    117118  m_lineBufWidth = 0;
     
    169170  }
    170171
     172#if !SAO_SGN_FUNC
    171173  //look-up table for clipping
     174  Int overallMaxSampleValue=0;
     175#endif
    172176  for(Int compIdx =0; compIdx < NUM_SAO_COMPONENTS; compIdx++)
    173177  {
     
    179183    Int maxOffsetValue = (g_saoMaxOffsetQVal[compIdx] << m_offsetStepLog2[compIdx]);
    180184#endif
     185#if !SAO_SGN_FUNC
     186    if (maxSampleValue>overallMaxSampleValue) overallMaxSampleValue=maxSampleValue;
     187#endif
    181188
    182189    m_offsetClipTable[compIdx] = new Int[(maxSampleValue + maxOffsetValue -1)+ (maxOffsetValue)+1 ]; //positive & negative range plus 0
     
    194201      *(offsetClipPtr -k -1 )              = 0;
    195202    }
    196     if(compIdx == SAO_Y) //g_bitDepthY is always larger than or equal to g_bitDepthC
    197     {
    198       m_signTable = new Short[ 2*(maxSampleValue-1) + 1 ];
    199       m_sign = &(m_signTable[maxSampleValue-1]);
    200 
    201       m_sign[0] = 0;
    202       for(Int k=1; k< maxSampleValue; k++)
    203       {
    204         m_sign[k] = 1;
    205         m_sign[-k]= -1;
    206       }
    207     }
    208   } 
    209 
     203  }
     204
     205#if !SAO_SGN_FUNC
     206  m_signTable = new Short[ 2*(overallMaxSampleValue-1) + 1 ];
     207  m_sign = &(m_signTable[overallMaxSampleValue-1]);
     208
     209  m_sign[0] = 0;
     210  for(Int k=1; k< overallMaxSampleValue; k++)
     211  {
     212    m_sign[k] = 1;
     213    m_sign[-k]= -1;
     214  }
     215#endif
    210216}
    211217
     
    226232    }
    227233  }
     234#if !SAO_SGN_FUNC
    228235  if( m_signTable )
    229236  {
    230237    delete[] m_signTable; m_signTable = NULL;
    231238  }
     239#endif
    232240}
    233241
     
    406414      for (y=0; y< height; y++)
    407415      {
     416#if SAO_SGN_FUNC
     417        signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]);
     418#else
    408419        signLeft = (Char)m_sign[srcLine[startX] - srcLine[startX-1]];
     420#endif
    409421        for (x=startX; x< endX; x++)
    410422        {
     423#if SAO_SGN_FUNC
     424          signRight = (Char)sgn(srcLine[x] - srcLine[x+1]);
     425#else
    411426          signRight = (Char)m_sign[srcLine[x] - srcLine[x+1]];
     427#endif
    412428          edgeType =  signRight + signLeft;
    413429          signLeft  = -signRight;
     
    437453      for (x=0; x< width; x++)
    438454      {
     455#if SAO_SGN_FUNC
     456        signUpLine[x] = (Char)sgn(srcLine[x] - srcLineAbove[x]);
     457#else
    439458        signUpLine[x] = (Char)m_sign[srcLine[x] - srcLineAbove[x]];
     459#endif
    440460      }
    441461
     
    447467        for (x=0; x< width; x++)
    448468        {
     469#if SAO_SGN_FUNC
     470          signDown  = (Char)sgn(srcLine[x] - srcLineBelow[x]);
     471#else
    449472          signDown  = (Char)m_sign[srcLine[x] - srcLineBelow[x]];
     473#endif
    450474          edgeType = signDown + signUpLine[x];
    451475          signUpLine[x]= -signDown;
     
    474498      for (x=startX; x< endX+1; x++)
    475499      {
     500#if SAO_SGN_FUNC
     501        signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x- 1]);
     502#else
    476503        signUpLine[x] = (Char)m_sign[srcLineBelow[x] - srcLine[x- 1]];
     504#endif
    477505      }
    478506
     
    483511      for(x= firstLineStartX; x< firstLineEndX; x++)
    484512      {
     513#if SAO_SGN_FUNC
     514        edgeType  =  sgn(srcLine[x] - srcLineAbove[x- 1]) - signUpLine[x+1];
     515#else
    485516        edgeType  =  m_sign[srcLine[x] - srcLineAbove[x- 1]] - signUpLine[x+1];
     517#endif
    486518        resLine[x] = offsetClip[srcLine[x] + offset[edgeType]];
    487519      }
     
    497529        for (x=startX; x<endX; x++)
    498530        {
     531#if SAO_SGN_FUNC
     532          signDown =  (Char)sgn(srcLine[x] - srcLineBelow[x+ 1]);
     533#else
    499534          signDown =  (Char)m_sign[srcLine[x] - srcLineBelow[x+ 1]] ;
     535#endif
    500536          edgeType =  signDown + signUpLine[x];
    501537          resLine[x] = offsetClip[srcLine[x] + offset[edgeType]];
     
    503539          signDownLine[x+1] = -signDown;
    504540        }
     541#if SAO_SGN_FUNC
     542        signDownLine[startX] = (Char)sgn(srcLineBelow[startX] - srcLine[startX-1]);
     543#else
    505544        signDownLine[startX] = (Char)m_sign[srcLineBelow[startX] - srcLine[startX-1]];
     545#endif
    506546
    507547        signTmpLine  = signUpLine;
     
    519559      for(x= lastLineStartX; x< lastLineEndX; x++)
    520560      {
     561#if SAO_SGN_FUNC
     562        edgeType =  sgn(srcLine[x] - srcLineBelow[x+ 1]) + signUpLine[x];
     563#else
    521564        edgeType =  m_sign[srcLine[x] - srcLineBelow[x+ 1]] + signUpLine[x];
     565#endif
    522566        resLine[x] = offsetClip[srcLine[x] + offset[edgeType]];
    523567
     
    537581      for (x=startX-1; x< endX; x++)
    538582      {
     583#if SAO_SGN_FUNC
     584        signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x+1]);
     585#else
    539586        signUpLine[x] = (Char)m_sign[srcLineBelow[x] - srcLine[x+1]];
     587#endif
    540588      }
    541589
     
    547595      for(x= firstLineStartX; x< firstLineEndX; x++)
    548596      {
     597#if SAO_SGN_FUNC
     598        edgeType = sgn(srcLine[x] - srcLineAbove[x+1]) -signUpLine[x-1];
     599#else
    549600        edgeType = m_sign[srcLine[x] - srcLineAbove[x+1]] -signUpLine[x-1];
     601#endif
    550602        resLine[x] = offsetClip[srcLine[x] + offset[edgeType]];
    551603      }
     
    560612        for(x= startX; x< endX; x++)
    561613        {
     614#if SAO_SGN_FUNC
     615          signDown =  (Char)sgn(srcLine[x] - srcLineBelow[x-1]);
     616#else
    562617          signDown =  (Char)m_sign[srcLine[x] - srcLineBelow[x-1]] ;
     618#endif
    563619          edgeType =  signDown + signUpLine[x];
    564620          resLine[x] = offsetClip[srcLine[x] + offset[edgeType]];
    565621          signUpLine[x-1] = -signDown;
    566622        }
     623#if SAO_SGN_FUNC
     624        signUpLine[endX-1] = (Char)sgn(srcLineBelow[endX-1] - srcLine[endX]);
     625#else
    567626        signUpLine[endX-1] = (Char)m_sign[srcLineBelow[endX-1] - srcLine[endX]];
     627#endif
    568628        srcLine  += srcStride;
    569629        resLine += resStride;
     
    576636      for(x= lastLineStartX; x< lastLineEndX; x++)
    577637      {
     638#if SAO_SGN_FUNC
     639        edgeType = sgn(srcLine[x] - srcLineBelow[x-1]) + signUpLine[x];
     640#else
    578641        edgeType = m_sign[srcLine[x] - srcLineBelow[x-1]] + signUpLine[x];
     642#endif
    579643        resLine[x] = offsetClip[srcLine[x] + offset[edgeType]];
    580644
  • branches/SHM-6-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h

    r644 r652  
    5656extern UInt g_saoMaxOffsetQVal[NUM_SAO_COMPONENTS];
    5757#endif
     58#if SAO_SGN_FUNC
     59template <typename T> int sgn(T val)
     60{
     61  return (T(0) < val) - (val < T(0));
     62}
     63#endif
    5864
    5965class TComSampleAdaptiveOffset
     
    8894  UInt m_offsetStepLog2[NUM_SAO_COMPONENTS]; //offset step 
    8995  Int* m_offsetClip[NUM_SAO_COMPONENTS]; //clip table for fast operation
     96#if !SAO_SGN_FUNC
    9097  Short* m_sign; //sign table for fast operation
     98#endif
    9199  TComPicYuv*   m_tempPicYuv; //temporary buffer
    92100  Int m_picWidth;
     
    105113  Bool m_picSAOEnabled[NUM_SAO_COMPONENTS];
    106114  Int*   m_offsetClipTable[NUM_SAO_COMPONENTS];
     115#if !SAO_SGN_FUNC
    107116  Short* m_signTable;
     117#endif
    108118#if SVC_EXTENSION
    109119  UInt m_saoMaxOffsetQVal[NUM_SAO_COMPONENTS];
  • branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.cpp

    r644 r652  
    7575, m_pcPic                         ( NULL )
    7676, m_colFromL0Flag                 ( 1 )
     77#if SETTING_NO_OUT_PIC_PRIOR
     78, m_noOutputPriorPicsFlag         ( false )
     79, m_noRaslOutputFlag              ( false )
     80, m_handleCraAsBlaFlag            ( false )
     81#endif
    7782, m_colRefIdx                     ( 0 )
    7883, m_uiTLayer                      ( 0 )
     
    111116, m_bCrossLayerBLAFlag            ( false )
    112117#endif
    113 #if NO_OUTPUT_OF_PRIOR_PICS
    114 , m_noOutputOfPriorPicsFlag       ( false )
    115 , m_noRaslOutputFlag              ( false )
    116 , m_handleCraAsBlaFlag            ( false )
    117 #endif
    118118#if POC_RESET_IDC_SIGNALLING
    119119, m_pocResetIdc                   ( 0 )
     
    596596    // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
    597597#if SVC_EXTENSION    // inter-layer prediction is allowed for BLA, CRA pictures of nuh_layer_id>0
    598     // If the current picture is a BLA or CRA picture with nuh_layer_id equal to 0, the value of NumPocTotalCurr shall be equal to 0.
    599     // Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
     598    // - If the current picture is a BLA or CRA picture with nuh_layer_id equal to 0, the value of NumPocTotalCurr shall be equal to 0.
     599    // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
    600600    if (getRapPicFlag() && getLayerId()==0)
    601601#else
    602     // If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    603     // Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
     602    // - If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     603    // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
    604604    if (getRapPicFlag())
    605605#endif
     
    10511051      pocCRA = pocCurr;
    10521052    }
     1053#if EFFICIENT_FIELD_IRAP
     1054    bRefreshPending = true;
     1055#endif
    10531056  }
    10541057  else // CRA or No DR
    10551058  {
     1059#if EFFICIENT_FIELD_IRAP
     1060    if(getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL)
     1061    {
     1062      if (bRefreshPending==true && pocCurr > m_iLastIDR) // IDR reference marking pending
     1063      {
     1064        TComList<TComPic*>::iterator        iterPic       = rcListPic.begin();
     1065        while (iterPic != rcListPic.end())
     1066        {
     1067          rpcPic = *(iterPic);
     1068          if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != m_iLastIDR)
     1069          {
     1070            rpcPic->getSlice(0)->setReferenced(false);
     1071          }
     1072          iterPic++;
     1073        }
     1074        bRefreshPending = false;
     1075      }
     1076    }
     1077    else
     1078    {
     1079#endif
    10561080    if (bRefreshPending==true && pocCurr > pocCRA) // CRA reference marking pending
    10571081    {
     
    10681092      bRefreshPending = false;
    10691093    }
     1094#if EFFICIENT_FIELD_IRAP
     1095    }
     1096#endif
    10701097    if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found
    10711098    {
     
    13231350    // in decoding order shall precede the IRAP picture in output order.
    13241351    // (Note that any picture following in output order would be present in the DPB)
     1352#if !SETTING_NO_OUT_PIC_PRIOR
    13251353    if(rpcPic->getSlice(0)->getPicOutputFlag() == 1)
     1354#else
     1355    if(rpcPic->getSlice(0)->getPicOutputFlag() == 1 && !this->getNoOutputPriorPicsFlag())
     1356#endif
    13261357    {
    13271358      if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP    ||
     
    15021533/** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet.
    15031534*/
     1535#if ALLOW_RECOVERY_POINT_AS_RAP
     1536Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess, Bool bUseRecoveryPoint)
     1537#else
    15041538Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess)
    1505 {
     1539#endif
     1540{
     1541#if ALLOW_RECOVERY_POINT_AS_RAP
     1542  Int atLeastOneUnabledByRecoveryPoint = 0;
     1543  Int atLeastOneFlushedByPreviousIDR = 0;
     1544#endif
    15061545  TComPic* rpcPic;
    15071546  Int i, isAvailable;
     
    15241563        if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i) && rpcPic->getSlice(0)->isReferenced())
    15251564        {
     1565#if ALLOW_RECOVERY_POINT_AS_RAP
     1566          if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess)
     1567          {
     1568            isAvailable = 0;
     1569          }
     1570          else
     1571          {
    15261572          isAvailable = 1;
     1573        }
     1574#else
     1575          isAvailable = 1;
     1576#endif
    15271577        }
    15281578      }
     
    15341584        if(rpcPic->getIsLongTerm() && curPoc == refPoc && rpcPic->getSlice(0)->isReferenced())
    15351585        {
     1586#if ALLOW_RECOVERY_POINT_AS_RAP
     1587          if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess)
     1588          {
     1589            isAvailable = 0;
     1590          }
     1591          else
     1592          {
    15361593          isAvailable = 1;
     1594        }
     1595#else
     1596          isAvailable = 1;
     1597#endif
    15371598        }
    15381599      }
     
    15571618        if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc)
    15581619        {
     1620#if ALLOW_RECOVERY_POINT_AS_RAP
     1621          if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess)
     1622          {
     1623            isAvailable = 0;
     1624          }
     1625          else
     1626          {
    15591627          isAvailable = 1;
    15601628          rpcPic->setIsLongTerm(1);
    15611629          break;
     1630        }
     1631#else
     1632          isAvailable = 1;
     1633          rpcPic->setIsLongTerm(1);
     1634          break;
     1635#endif
    15621636        }
    15631637      }
     
    15871661        }
    15881662      }
     1663#if ALLOW_RECOVERY_POINT_AS_RAP
     1664      else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess)
     1665      {
     1666        atLeastOneUnabledByRecoveryPoint = 1;
     1667      }
     1668      else if(bUseRecoveryPoint && (this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_W_RADL))
     1669      {
     1670        atLeastOneFlushedByPreviousIDR = 1;
     1671      }
     1672#endif
    15891673    }
    15901674  } 
     
    16021686      if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced())
    16031687      {
     1688#if ALLOW_RECOVERY_POINT_AS_RAP
     1689        if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess)
     1690        {
     1691          isAvailable = 0;
     1692        }
     1693        else
     1694        {
    16041695        isAvailable = 1;
     1696      }
     1697#else
     1698        isAvailable = 1;
     1699#endif
    16051700      }
    16061701    }
     
    16291724        }
    16301725      }
    1631     }
     1726#if ALLOW_RECOVERY_POINT_AS_RAP
     1727      else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess)
     1728      {
     1729        atLeastOneUnabledByRecoveryPoint = 1;
     1730      }
     1731      else if(bUseRecoveryPoint && (this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getAssociatedIRAPType()==NAL_UNIT_CODED_SLICE_IDR_W_RADL))
     1732      {
     1733        atLeastOneFlushedByPreviousIDR = 1;
     1734      }
     1735#endif
     1736    }
     1737    }
     1738#if ALLOW_RECOVERY_POINT_AS_RAP
     1739  if(atLeastOneUnabledByRecoveryPoint || atLeastOneFlushedByPreviousIDR)
     1740  {
     1741    return -1;
    16321742  }   
     1743#endif
    16331744  if(atLeastOneLost)
    16341745  {
     
    16471758/** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set
    16481759*/
     1760#if ALLOW_RECOVERY_POINT_AS_RAP
     1761Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP, Int pocRandomAccess, Bool bUseRecoveryPoint)
     1762#else
    16491763Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP)
     1764#endif
    16501765{
    16511766  TComPic* rpcPic;
     
    16731788        pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i));
    16741789        pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP));
     1790#if ALLOW_RECOVERY_POINT_AS_RAP
     1791        pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) );
     1792#endif
    16751793        if(pcRPS->getDeltaPOC(k) < 0)
    16761794        {
     
    16851803    }
    16861804  }
     1805#if EFFICIENT_FIELD_IRAP
     1806  Bool useNewRPS = false;
     1807  // if current picture is complimentary field associated to IRAP, add the IRAP to its RPS.
     1808  if(m_pcPic->isField())
     1809  {
     1810    TComList<TComPic*>::iterator iterPic = rcListPic.begin();
     1811    while ( iterPic != rcListPic.end())
     1812    {
     1813      rpcPic = *(iterPic++);
     1814      if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC()+1)
     1815      {
     1816        pcRPS->setDeltaPOC(k, 1);
     1817        pcRPS->setUsed(k, true);
     1818        nrOfPositivePictures++;
     1819        k ++;
     1820        useNewRPS = true;
     1821      }
     1822    }
     1823  }
     1824#endif
    16871825  pcRPS->setNumberOfNegativePictures(nrOfNegativePictures);
    16881826  pcRPS->setNumberOfPositivePictures(nrOfPositivePictures);
     
    16911829  // inter RPS prediction with.  Here we just use the reference used by pReferencePictureSet.
    16921830  // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled.
    1693   if (!pReferencePictureSet->getInterRPSPrediction())
     1831  if (!pReferencePictureSet->getInterRPSPrediction()
     1832#if EFFICIENT_FIELD_IRAP
     1833    || useNewRPS
     1834#endif
     1835    )
    16941836  {
    16951837    pcRPS->setInterRPSPrediction(false);
  • branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.h

    r644 r652  
    231231{
    232232  ProfileTierLevel m_generalPTL;
    233   ProfileTierLevel m_subLayerPTL    [MAX_TLAYER-1];      // max. value of max_sub_layers_minus1 is MAX_TLAYER-1 ( = 6 )
     233  ProfileTierLevel m_subLayerPTL    [MAX_TLAYER-1];      // max. value of max_sub_layers_minus1 is MAX_TLAYER-1 (= 6)
    234234  Bool m_subLayerProfilePresentFlag [MAX_TLAYER-1];
    235235  Bool m_subLayerLevelPresentFlag   [MAX_TLAYER-1];
     
    19631963  UInt        m_colFromL0Flag;  // collocated picture from List0 flag
    19641964 
     1965#if SETTING_NO_OUT_PIC_PRIOR
     1966  Bool        m_noOutputPriorPicsFlag;
     1967  Bool        m_noRaslOutputFlag;
     1968  Bool        m_handleCraAsBlaFlag;
     1969#endif
     1970 
    19651971  UInt        m_colRefIdx;
    19661972  UInt        m_maxNumMergeCand;
     
    20292035#if O0149_CROSS_LAYER_BLA_FLAG
    20302036  Bool        m_bCrossLayerBLAFlag;
    2031 #endif
    2032 #if NO_OUTPUT_OF_PRIOR_PICS
    2033   Bool        m_noOutputOfPriorPicsFlag;
    2034   Bool        m_noRaslOutputFlag;
    2035   Bool        m_handleCraAsBlaFlag;
    20362037#endif
    20372038#if POC_RESET_IDC_SIGNALLING
     
    21302131  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
    21312132  Bool      getRapPicFlag       (); 
    2132 #if NO_OUTPUT_OF_PRIOR_PICS
    2133   Bool      getBlaPicFlag       ();
    2134   Bool      getCraPicFlag       ();
    2135 #endif
    21362133  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
    21372134  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
     
    22032200  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
    22042201  Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic );
    2205   Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0);
    2206   Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP);
     2202#if ALLOW_RECOVERY_POINT_AS_RAP
     2203  Int  checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0, Bool bUseRecoveryPoint = false);
     2204  Void createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP, Int pocRandomAccess = 0, Bool bUseRecoveryPoint = false);
     2205#else
     2206  Int  checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0);
     2207  Void createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP);
     2208#endif
    22072209
    22082210  Void setMaxNumMergeCand               (UInt val )         { m_maxNumMergeCand = val;                    }
    22092211  UInt getMaxNumMergeCand               ()                  { return m_maxNumMergeCand;                   }
     2212
     2213#if SETTING_NO_OUT_PIC_PRIOR
     2214  Void setNoOutputPriorPicsFlag         ( Bool val )        { m_noOutputPriorPicsFlag = val;                    }
     2215  Bool getNoOutputPriorPicsFlag         ()                  { return m_noOutputPriorPicsFlag;                   }
     2216
     2217  Void setNoRaslOutputFlag              ( Bool val )        { m_noRaslOutputFlag = val;                    }
     2218  Bool getNoRaslOutputFlag              ()                  { return m_noRaslOutputFlag;                   }
     2219
     2220  Void setHandleCraAsBlaFlag            ( Bool val )        { m_handleCraAsBlaFlag = val;                    }
     2221  Bool getHandleCraAsBlaFlag            ()                  { return m_handleCraAsBlaFlag;                   }
     2222#endif
    22102223
    22112224  Void setSliceMode                     ( UInt uiMode )     { m_sliceMode = uiMode;                     }
     
    23602373
    23612374  Void setILRPic(TComPic **pcIlpPic);
    2362 #if NO_OUTPUT_OF_PRIOR_PICS
    2363   Void setNoOutputOfPriorPicsFlag(const Bool x)   { m_noOutputOfPriorPicsFlag = x;    }
    2364   Bool getNoOutputOfPriorPicsFlag()               { return m_noOutputOfPriorPicsFlag; }
    2365 
    2366   Void setNoRaslOutputFlag    ( const Bool val )   { m_noRaslOutputFlag = val;  }
    2367   Bool getNoRaslOutputFlag    ()                   { return m_noRaslOutputFlag; }
    2368 
    2369   Void setHandleCraAsBlaFlag  ( const Bool val )   { m_handleCraAsBlaFlag = val;  }
    2370   Bool getHandleCraAsBlaFlag  ()                   { return m_handleCraAsBlaFlag; }
    2371 
    2372 #endif
    23732375#if POC_RESET_IDC_SIGNALLING
    23742376  Int       getPocResetIdc       ()                              { return m_pocResetIdc;       }
     
    23882390#endif
    23892391
     2392#if NO_OUTPUT_OF_PRIOR_PICS
     2393  Bool      getBlaPicFlag       ();
     2394  Bool      getCraPicFlag       ();
     2395#endif
     2396
    23902397#endif //SVC_EXTENSION
    23912398protected:
  • branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h

    r644 r652  
    264264//! \ingroup TLibCommon
    265265//! \{
     266#define HARMONIZE_GOP_FIRST_FIELD_COUPLE  1
     267#define FIX_FIELD_DEPTH                 1
     268#define EFFICIENT_FIELD_IRAP            1
     269#define ALLOW_RECOVERY_POINT_AS_RAP     1
    266270#define BUGFIX_INTRAPERIOD 1
    267271#define SAO_ENCODE_ALLOW_USE_PREDEBLOCK 1
    268272
     273#define SAO_SGN_FUNC 1
     274
    269275#define FIX1172 1 ///< fix ticket #1172
     276
     277#define SETTING_PIC_OUTPUT_MARK     1
     278#define SETTING_NO_OUT_PIC_PRIOR    1
     279#define FIX_EMPTY_PAYLOAD_NAL       1
     280#define FIX_WRITING_OUTPUT          1
     281#define FIX_OUTPUT_EOS              1
     282
     283#define FIX_POC_CRA_NORASL_OUTPUT   1
    270284
    271285#define MAX_NUM_PICS_IN_SOP           1024
Note: See TracChangeset for help on using the changeset viewer.