Changeset 134 in SHVCSoftware for branches


Ignore:
Timestamp:
2 May 2013, 02:57:45 (12 years ago)
Author:
seregin
Message:

add reference layer dependency

Location:
branches/SHM-2.0-dev/source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-2.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r133 r134  
    141141Void TAppEncCfg::destroy()
    142142{
     143#if VPS_EXTN_DIRECT_REF_LAYERS
     144  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     145  {
     146    if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 )
     147    {
     148      delete [] m_acLayerCfg[layer].m_refLayerIds;
     149    }
     150  }
     151#endif
    143152}
    144153
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r125 r134  
    18351835  {
    18361836    Int refIdxL0 = cMvFieldL0.getRefIdx();
    1837     if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR())
     1837    if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR(m_layerId))
    18381838    {
    18391839      checkZeroMVILR &= (cMvFieldL0.getHor() == 0 && cMvFieldL0.getVer() == 0);
     
    18431843  {
    18441844    Int refIdxL1  = cMvFieldL1.getRefIdx();
    1845     if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR())
     1845    if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR(m_layerId))
    18461846    {
    18471847      checkZeroMVILR &= (cMvFieldL1.getHor() == 0 && cMvFieldL1.getVer() == 0);
     
    18591859  Bool checkZeroMVILR = true;
    18601860
    1861   if(getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR())
     1861  if(getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(m_layerId))
    18621862  {
    18631863    AMVPInfo* pcAMVPInfo = getCUMvField(eRefPicList)->getAMVPInfo();
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComPic.h

    r125 r134  
    124124#endif
    125125#if REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM
    126   Bool          isILR( UInt refLayer = 0 )   {return (getIsLongTerm() && m_layerId == refLayer);}
     126  Bool          isILR( UInt currLayerId )   { return ( getIsLongTerm() && m_layerId < currLayerId ); }
    127127#endif
    128128
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComPrediction.cpp

    r133 r134  
    495495
    496496#if REF_IDX_ME_ZEROMV
    497   assert( ( pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR() && cMv.getHor() == 0 && cMv.getVer() == 0 ) || pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR() == false );
     497  assert( ( pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(pcCU->getLayerId()) && cMv.getHor() == 0 && cMv.getVer() == 0 ) || pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx)->isILR(pcCU->getLayerId()) == false );
    498498#endif
    499499
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComSlice.h

    r133 r134  
    663663#if VPS_EXTN_DIRECT_REF_LAYERS
    664664  // Direct dependency of layers
    665   Bool   getDirectDependencyFlag(Int i, Int j)                  { return m_directDependencyFlag[i][j]; }
    666   Void   setDirectDependencyFlag(Int i, Int j, Bool x)          { m_directDependencyFlag[i][j] = x;    }
    667  
    668   UInt   getNumDirectRefLayers(Int i)                                { return m_numDirectRefLayers[i];         }
    669   Void   setNumDirectRefLayers(Int i, UInt x)                        { m_numDirectRefLayers[i] = x;            }
    670 
    671   UInt   getRefLayerId(Int i, Int j)                            { return m_refLayerId[i][j];           }
    672   Void   setRefLayerId(Int i, Int j, UInt x)                    { m_refLayerId[i][j] = x;              }
     665  Bool   getDirectDependencyFlag(Int currLayerId, Int refLayerId)               { return m_directDependencyFlag[currLayerId][refLayerId]; }
     666  Void   setDirectDependencyFlag(Int currLayerId, Int refLayerId, Bool x)       { m_directDependencyFlag[currLayerId][refLayerId] = x;    }
     667 
     668  UInt   getNumDirectRefLayers(Int layerId)                                     { return m_numDirectRefLayers[layerId];                   }
     669  Void   setNumDirectRefLayers(Int layerId, UInt refLayerNum)                   { m_numDirectRefLayers[layerId] = refLayerNum;            }
     670
     671  UInt   getRefLayerId(Int layerId, Int refLayerIdx)                            { return m_refLayerId[layerId][refLayerIdx];              }
     672  Void   setRefLayerId(Int layerId, Int refLayerIdx, UInt refLayerId)           { m_refLayerId[layerId][refLayerIdx] = refLayerId;        }
    673673#endif
    674674};
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TypeDef.h

    r133 r134  
    4444
    4545#if SVC_EXTENSION
     46#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     47
    4648#define VPS_RENAME                       1      ///< Rename variables max_layer_id and num_layer_sets_minus1 in VPS
    4749#define VPS_EXTNS                        1      ///< Include function structure for VPS extensions
     
    5153#define VPS_EXTN_PROFILE_INFO            1      ///< Include profile information for layer sets in VPS extension
    5254#define VPS_EXTN_DIRECT_REF_LAYERS       1      ///< Include indication of direct dependency of layers in VPS extension
    53 #endif
    54 #define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     55#define VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE   1
     56#endif
    5557
    5658#define SVC_COL_BLK                      1      ///< get co-located block
     
    159161#if VPS_RENAME
    160162#define MAX_VPS_LAYER_SETS_PLUS1                  1024
    161 #define MAX_VPS_LAYER_ID_PLUS1                    2
     163#define MAX_VPS_LAYER_ID_PLUS1                    MAX_LAYERS
    162164#else
    163165#define MAX_VPS_NUM_HRD_PARAMETERS                1
  • branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecGop.cpp

    r125 r134  
    247247    for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++)
    248248    {
     249#if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE
     250      if( pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->isILR( m_layerId ) )
     251      {
     252        printf( "%d(%d) ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() );
     253      }
     254      else
     255#endif
    249256      printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex));
    250257    }
  • branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r133 r134  
    179179    m_cIlpPic[0]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(), m_cIlpPic[0]->getPicYuvRec());
    180180    m_cIlpPic[0]->getSlice(0)->setPOC(pcPic->getPOC());
    181     m_cIlpPic[0]->setLayerId(0); //set reference layerId
     181    m_cIlpPic[0]->setLayerId(pcPic->getSlice(0)->getBaseColPic()->getLayerId()); //set reference layerId
    182182    m_cIlpPic[0]->getPicYuvRec()->setBorderExtension(false);
    183183    m_cIlpPic[0]->getPicYuvRec()->extendPicBorder();
     
    243243    if(m_layerId > 0)
    244244    {
     245#if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE
     246      TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( m_layerId );
     247#else
    245248      TDecTop *pcTDecTopBase = (TDecTop *)getLayerDec( m_layerId-1 );
     249#endif
    246250      //TComPic*                      pcPic = *(pcTDecTopBase->getListPic()->begin());
    247251      TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec();
     
    795799
    796800#else
     801#if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE
     802      TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( m_layerId );
     803#else
    797804      TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 );
     805#endif
    798806      TComList<TComPic*> *cListPic = pcTDecTop->getListPic();
    799807      pcSlice->setBaseColPic ( *cListPic, m_layerId );
     
    11751183}
    11761184
     1185#if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE
     1186TDecTop* TDecTop::getRefLayerDec( UInt layerId )
     1187{
     1188  TComVPS* vps = m_parameterSetManagerDecoder[0].getActiveVPS();
     1189  if( vps->getNumDirectRefLayers( m_layerId ) <= 0 )
     1190  {
     1191    return NULL;
     1192  }
     1193
     1194  // currently only one reference layer is supported
     1195  assert( vps->getNumDirectRefLayers( m_layerId ) == 1 );
     1196
     1197  return (TDecTop *)getLayerDec( vps->getRefLayerId( m_layerId, 0 ) );
     1198}
     1199#endif
     1200
    11771201//! \}
  • branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecTop.h

    r125 r134  
    154154  Void      setNumLayer           (UInt uiNum)   { m_numLayer = uiNum;  }
    155155  TComList<TComPic*>*      getListPic() { return &m_cListPic; }
    156   Void                setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
    157   TDecTop*            getLayerDec(UInt layer)   { return m_ppcTDecTop[layer]; }
     156  Void      setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
     157  TDecTop*  getLayerDec(UInt layer)     { return m_ppcTDecTop[layer]; }
     158#if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE
     159  TDecTop*  getRefLayerDec(UInt layerId);
     160#endif
    158161#if AVC_BASE
    159162  Void      setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; }
  • branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r133 r134  
    534534    if (m_layerId > 0)
    535535    {
     536#if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE
     537      TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(m_layerId)->getListPic();
     538#else
    536539      TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId-1]->getListPic();
     540#endif
    537541      pcSlice->setBaseColPic (*cListPic, m_layerId );
    538542    }
     
    734738        for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++)
    735739        {
    736           if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR() )
     740          if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) )
    737741          {
    738742            ColRefIdx = colIdx;
     
    747751          for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++)
    748752          {
    749             if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR() )
     753            if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) )
    750754            {
    751755              ColRefIdx = colIdx;
     
    25502554    for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++)
    25512555    {
     2556#if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE
     2557      if( pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->isILR(m_layerId) )
     2558      {
     2559        printf( "%d(%d) ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)-pcSlice->getLastIDR(), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() );
     2560      }
     2561      else
     2562#endif
    25522563      printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)-pcSlice->getLastIDR());
    25532564    }
  • branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r133 r134  
    32963296#if (ENCODER_FAST_MODE)
    32973297        TComPic* pcPic    = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp );
    3298         if( !testILR && pcPic->isILR() && (ePartSize == SIZE_2Nx2N) )
     3298        if( !testILR && pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N) )
    32993299        {
    33003300          continue;
     
    36223622        Bool     testIter = true;
    36233623        TComPic* pcPic    = pcCU->getSlice()->getRefPic( RefPicList(1 - iRefList), iRefIdxBi[1 - iRefList] );
    3624         if(pcPic->isILR() && (ePartSize == SIZE_2Nx2N))
     3624        if(pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N))
    36253625        {
    36263626          testIter = false;  //the fixed part is ILR, skip this iteration       
     
    36373637          Bool testRefIdx = true;
    36383638          pcPic           = pcCU->getSlice()->getRefPic( RefPicList(iRefList) , iRefIdxTemp );
    3639           if(pcPic->isILR() && (ePartSize == SIZE_2Nx2N))
     3639          if(pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N))
    36403640          {
    36413641            testRefIdx = false;  //the refined part is ILR, skip this reference pic           
     
    43084308  //  Do integer search
    43094309#if REF_IDX_ME_ZEROMV
    4310   if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR())  //ILR reference pic
     4310  if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR(pcCU->getLayerId()))  //ILR reference pic
    43114311  {
    43124312    rcMv.setZero();  //use Mv(0, 0) for integer ME
     
    43414341  {
    43424342#if REF_IDX_ME_ZEROMV
    4343     if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR())  //ILR reference pic
     4343    if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR(pcCU->getLayerId()))  //ILR reference pic
    43444344    {
    43454345      xPatternSearchFracDIFMv0( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost, bBi );
     
    63156315    for( Int refIdx = 0; refIdx < pcCU->getSlice()->getNumRefIdx(eRefPicList); refIdx++ )
    63166316    {
    6317       if( pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->isILR() )
     6317      if( pcCU->getSlice()->getRefPic(eRefPicList, refIdx)->isILR(pcCU->getLayerId()) )
    63186318      {
    63196319        iRefIdxTemp = refIdx;
  • branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r133 r134  
    500500    {
    501501      TEncPic* pcEPic = new TEncPic;
    502 #if SVC_EXTENSION //Temporal solution, should be modified
    503       if(m_layerId > 0)
    504       {
    505         TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 );
    506         if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() )
    507         {
    508           pcEPic->setSpatialEnhLayerFlag( true );
    509         }
    510       }
    511 #endif
    512502
    513503#if SVC_UPSAMPLING
     
    524514      rpcPic = new TComPic;
    525515
    526 #if SVC_EXTENSION //Temporal solution, should be modified
    527       if(m_layerId > 0)
    528       {
    529         TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 );
    530         if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() )
    531         {
    532           rpcPic->setSpatialEnhLayerFlag( true );
    533         }
    534       }
    535 #endif
    536516
    537517#if SVC_UPSAMPLING
     
    543523#endif
    544524    }
     525
     526#if SVC_EXTENSION //Temporal solution, should be modified
     527      if(m_layerId > 0)
     528      {
     529#if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE
     530        TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( m_layerId );
     531#else
     532        TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 );
     533#endif
     534        if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() )
     535        {
     536          rpcPic->setSpatialEnhLayerFlag( true );
     537        }
     538      }
     539#endif
     540
    545541    if (getUseSAO())
    546542    {
     
    11751171}
    11761172
     1173#if SVC_EXTENSION
     1174#if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE
     1175TEncTop* TEncTop::getRefLayerEnc( UInt layerId )
     1176{
     1177  if( m_ppcTEncTop[m_layerId]->getNumDirectRefLayers() <= 0 )
     1178  {
     1179    return NULL;
     1180  }
     1181
     1182  // currently only one reference layer is supported
     1183  assert( m_ppcTEncTop[m_layerId]->getNumDirectRefLayers() == 1 );
     1184
     1185  return (TEncTop *)getLayerEnc( getVPS()->getRefLayerId( m_layerId, 0 ) );
     1186}
     1187#endif
     1188
    11771189#if REF_IDX_FRAMEWORK
    11781190Void TEncTop::xInitILRP()
     
    12111223    m_cIlpPic[0]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(), m_cIlpPic[0]->getPicYuvRec());
    12121224    m_cIlpPic[0]->getSlice(0)->setPOC(pcPic->getPOC());
    1213     m_cIlpPic[0]->setLayerId(0); //set reference layerId
     1225    m_cIlpPic[0]->setLayerId(pcPic->getSlice(0)->getBaseColPic()->getLayerId()); //set reference layerId
    12141226    m_cIlpPic[0]->getPicYuvRec()->setBorderExtension(false);
    12151227    m_cIlpPic[0]->getPicYuvRec()->extendPicBorder();
     
    12171229}
    12181230#endif
     1231#endif
    12191232//! \}
  • branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncTop.h

    r133 r134  
    212212#if REF_IDX_FRAMEWORK
    213213  TComPic** getIlpList() { return m_cIlpPic; }
    214   Void setILRPic(TComPic *pcPic);
     214  Void      setILRPic(TComPic *pcPic);
    215215#endif
    216216#if REF_IDX_MFM
    217   Void setMFMEnabledFlag       (Bool flag)   {m_bMFMEnabledFlag = flag;}
    218   Bool getMFMEnabledFlag()                   {return m_bMFMEnabledFlag;}   
     217  Void      setMFMEnabledFlag       (Bool flag)   {m_bMFMEnabledFlag = flag;}
     218  Bool      getMFMEnabledFlag()                   {return m_bMFMEnabledFlag;}   
    219219#endif
    220220#if AVC_SYNTAX
     
    222222  fstream*  getBLSyntaxFile() { return m_pBLSyntaxFile; }
    223223#endif
    224   Void encode( TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
    225               std::list<AccessUnit>& accessUnitsOut, Int iPicIdInGOP  );
    226   Void encodePrep( TComPicYuv* pcPicYuvOrg );
     224  Void      encode( TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int iPicIdInGOP  );
     225  Void      encodePrep( TComPicYuv* pcPicYuvOrg );
     226#if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE
     227  TEncTop*  getRefLayerEnc(UInt layerId);
     228#endif
    227229#else
    228230  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
Note: See TracChangeset for help on using the changeset viewer.