Changeset 435 in SHVCSoftware for branches/SHM-3.1-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
14 Oct 2013, 16:04:33 (12 years ago)
Author:
nokia
Message:

add inter-layer constrained tiles sets SEI from JCTVC-N0383

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

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/SHM-3.1-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r313 r435  
    9595    fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
    9696    break;
     97#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     98  case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:
     99    fprintf( g_hTrace, "=========== Inter Layer Constrained Tile Sets SEI message ===========\n");
     100    break;
     101#endif
    97102  case SEI::SCALABLE_NESTING:
    98103    fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");
     
    153158    xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei));
    154159    break;
     160#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     161  case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:
     162    xWriteSEIInterLayerConstrainedTileSets(*static_cast<const SEIInterLayerConstrainedTileSets*>(&sei));
     163    break;
     164#endif
    155165  case SEI::SCALABLE_NESTING:
    156166    xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps);
     
    559569}
    560570
     571#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     572Void SEIWriter::xWriteSEIInterLayerConstrainedTileSets(const SEIInterLayerConstrainedTileSets& sei)
     573{
     574  WRITE_FLAG( sei.m_ilAllTilesExactSampleValueMatchFlag,  "il_all_tiles_exact_sample_value_match_flag"   );
     575  WRITE_FLAG( sei.m_ilOneTilePerTileSetFlag,              "il_one_tile_per_tile_set_flag"                );
     576  if( !sei.m_ilOneTilePerTileSetFlag )
     577  {
     578    WRITE_UVLC( sei.m_ilNumSetsInMessageMinus1,             "il_num_sets_in_message_minus1"                );
     579    if( sei.m_ilNumSetsInMessageMinus1 )
     580    {
     581      WRITE_FLAG( sei.m_skippedTileSetPresentFlag,            "skipped_tile_set_present_flag"                );
     582    }
     583    UInt numSignificantSets = sei.m_ilNumSetsInMessageMinus1 + (sei.m_skippedTileSetPresentFlag ? 1 : 0) + 1;
     584    for( UInt i = 0; i <= numSignificantSets; i++ )
     585    {
     586      WRITE_UVLC( sei.m_ilctsId[i],                           "ilcts_id"                                     );
     587      WRITE_UVLC( sei.m_ilNumTileRectsInSetMinus1[i],         "il_num_tile_rects_in_set_minus1"              );
     588      for( UInt j = 0; j <= sei.m_ilNumTileRectsInSetMinus1[i]; j++ )
     589      {
     590        WRITE_UVLC( sei.m_ilTopLeftTileIndex[i][j],             "il_top_left_tile_index"                       );
     591        WRITE_UVLC( sei.m_ilBottomRightTileIndex[i][j],         "il_bottom_right_tile_index"                   );
     592      }
     593      WRITE_CODE( sei.m_ilcIdc[i], 2,                         "ilc_idc"                                      );
     594      if( sei.m_ilAllTilesExactSampleValueMatchFlag )
     595      {
     596        WRITE_FLAG( sei.m_ilExactSampleValueMatchFlag[i],        "il_exact_sample_value_match_flag"            );
     597      }
     598    }
     599  }
     600  else
     601  {
     602    WRITE_CODE( sei.m_allTilesIlcIdc, 2,                    "all_tiles_ilc_idc"                          );
     603  }
     604
     605  xWriteByteAlign();
     606}
     607#endif
     608
    561609Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps)
    562610{
  • TabularUnified branches/SHM-3.1-dev/source/Lib/TLibEncoder/SEIwrite.h

    r313 r435  
    6868#endif
    6969  Void xWriteSEISOPDescription(const SEISOPDescription& sei);
     70#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     71  Void xWriteSEIInterLayerConstrainedTileSets(const SEIInterLayerConstrainedTileSets& sei);
     72#endif
    7073  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps);
    7174  Void xWriteByteAlign();
  • TabularUnified branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCfg.h

    r397 r435  
    318318  Int       m_SOPDescriptionSEIEnabled;
    319319  Int       m_scalableNestingSEIEnabled;
     320#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     321  Bool      m_interLayerConstrainedTileSetsSEIEnabled;
     322  UInt      m_ilNumSetsInMessage;
     323  Bool      m_skippedTileSetPresentFlag;
     324  UInt      m_topLeftTileIndex[1024];
     325  UInt      m_bottomRightTileIndex[1024];
     326  UInt      m_ilcIdc[1024];
     327#endif
    320328  //====== Weighted Prediction ========
    321329  Bool      m_useWeightedPred;       //< Use of Weighting Prediction (P_SLICE)
     
    757765  Void  setScalableNestingSEIEnabled(Int b)                { m_scalableNestingSEIEnabled = b; }
    758766  Int   getScalableNestingSEIEnabled()                     { return m_scalableNestingSEIEnabled; }
     767#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     768  Void  setInterLayerConstrainedTileSetsSEIEnabled(Bool b) { m_interLayerConstrainedTileSetsSEIEnabled = b; }
     769  Bool  getInterLayerConstrainedTileSetsSEIEnabled()       { return m_interLayerConstrainedTileSetsSEIEnabled; }
     770  Void  setIlNumSetsInMessage(UInt b)                      { m_ilNumSetsInMessage = b; }
     771  Int   getIlNumSetsInMessage()                            { return m_ilNumSetsInMessage; }
     772  Void  setSkippedTileSetPresentFlag(Bool b)               { m_skippedTileSetPresentFlag = b; }
     773  Bool  getSkippedTileSetPresentFlag()                     { return m_skippedTileSetPresentFlag; }
     774  Void  setTopLeftTileIndex(UInt *b)
     775  {
     776    for (UInt i = 0; i < m_ilNumSetsInMessage; i++)
     777    {
     778      m_topLeftTileIndex[i] = b[i];
     779    }
     780  }
     781  UInt  getTopLeftTileIndex(UInt b)                        { return m_topLeftTileIndex[b]; }
     782  Void  setBottomRightTileIndex(UInt *b)
     783  {
     784    for (UInt i = 0; i < m_ilNumSetsInMessage; i++)
     785    {
     786      m_bottomRightTileIndex[i] = b[i];
     787    }
     788  }
     789  UInt  getBottomRightTileIndex(UInt b)                    { return m_bottomRightTileIndex[b]; }
     790  Void  setIlcIdc(UInt *b)
     791  {
     792    for (UInt i = 0; i < m_ilNumSetsInMessage; i++)
     793    {
     794      m_ilcIdc[i] = b[i];
     795    }
     796  }
     797  UInt  getIlcIdc(UInt b)                                  { return m_ilcIdc[b]; }
     798#endif
    759799  Void      setUseWP               ( Bool b )    { m_useWeightedPred   = b;    }
    760800  Void      setWPBiPred            ( Bool b )    { m_useWeightedBiPred = b;    }
  • TabularUnified branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r434 r435  
    307307}
    308308
     309#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     310SEIInterLayerConstrainedTileSets* TEncGOP::xCreateSEIInterLayerConstrainedTileSets()
     311{
     312  SEIInterLayerConstrainedTileSets *seiInterLayerConstrainedTileSets = new SEIInterLayerConstrainedTileSets();
     313  seiInterLayerConstrainedTileSets->m_ilAllTilesExactSampleValueMatchFlag = false;
     314  seiInterLayerConstrainedTileSets->m_ilOneTilePerTileSetFlag = false;
     315  if (!seiInterLayerConstrainedTileSets->m_ilOneTilePerTileSetFlag)
     316  {
     317    seiInterLayerConstrainedTileSets->m_ilNumSetsInMessageMinus1 = m_pcCfg->getIlNumSetsInMessage() - 1;
     318    if (seiInterLayerConstrainedTileSets->m_ilNumSetsInMessageMinus1)
     319    {
     320      seiInterLayerConstrainedTileSets->m_skippedTileSetPresentFlag = m_pcCfg->getSkippedTileSetPresentFlag();
     321    }
     322    else
     323    {
     324      seiInterLayerConstrainedTileSets->m_skippedTileSetPresentFlag = false;
     325    }
     326    UInt numSignificantSets = seiInterLayerConstrainedTileSets->m_ilNumSetsInMessageMinus1 - (seiInterLayerConstrainedTileSets->m_skippedTileSetPresentFlag ? 1 : 0) + 1;
     327    for (UInt i = 0; i < numSignificantSets; i++)
     328    {
     329      seiInterLayerConstrainedTileSets->m_ilctsId[i] = i;
     330      seiInterLayerConstrainedTileSets->m_ilNumTileRectsInSetMinus1[i] = 0;
     331      for( UInt j = 0; j <= seiInterLayerConstrainedTileSets->m_ilNumTileRectsInSetMinus1[i]; j++)
     332      {
     333        seiInterLayerConstrainedTileSets->m_ilTopLeftTileIndex[i][j]     = m_pcCfg->getTopLeftTileIndex(i);
     334        seiInterLayerConstrainedTileSets->m_ilBottomRightTileIndex[i][j] = m_pcCfg->getBottomRightTileIndex(i);
     335      }
     336      seiInterLayerConstrainedTileSets->m_ilcIdc[i] = m_pcCfg->getIlcIdc(i);
     337      if (seiInterLayerConstrainedTileSets->m_ilAllTilesExactSampleValueMatchFlag)
     338      {
     339        seiInterLayerConstrainedTileSets->m_ilExactSampleValueMatchFlag[i] = false;
     340      }
     341    }
     342  }
     343
     344  return seiInterLayerConstrainedTileSets;
     345}
     346#endif
     347
    309348Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps)
    310349{
     
    369408    delete sei;
    370409  }
     410#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     411  if(m_pcCfg->getInterLayerConstrainedTileSetsSEIEnabled())
     412  {
     413    SEIInterLayerConstrainedTileSets *sei = xCreateSEIInterLayerConstrainedTileSets ();
     414
     415    nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, m_pcCfg->getNumLayer()-1); // For highest layer
     416    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     417    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     418    writeRBSPTrailingBits(nalu.m_Bitstream);
     419    accessUnit.push_back(new NALUnitEBSP(nalu));
     420    delete sei;
     421  }
     422#endif
    371423}
    372424
     
    14721524    pcPic->getPicSym()->xInitTiles();
    14731525
     1526#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1527    if (m_pcCfg->getInterLayerConstrainedTileSetsSEIEnabled())
     1528    {
     1529      xBuildTileSetsMap(pcPic->getPicSym());
     1530    }
     1531#endif
     1532
    14741533    // Allocate some coders, now we know how many tiles there are.
    14751534    Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams();
     
    34483507}
    34493508
     3509#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3510Void TEncGOP::xBuildTileSetsMap(TComPicSym* picSym)
     3511{
     3512  Int numCUs = picSym->getFrameWidthInCU() * picSym->getFrameHeightInCU();
     3513
     3514  for (Int i = 0; i < numCUs; i++)
     3515  {
     3516    picSym->setTileSetIdxMap(i, -1, 0, false);
     3517  }
     3518
     3519  for (Int i = 0; i < m_pcCfg->getIlNumSetsInMessage(); i++)
     3520  {
     3521    TComTile* topLeftTile     = picSym->getTComTile(m_pcCfg->getTopLeftTileIndex(i));
     3522    TComTile* bottomRightTile = picSym->getTComTile(m_pcCfg->getBottomRightTileIndex(i));
     3523    Int tileSetLeftEdgePosInCU = topLeftTile->getRightEdgePosInCU() - topLeftTile->getTileWidth() + 1;
     3524    Int tileSetRightEdgePosInCU = bottomRightTile->getRightEdgePosInCU();
     3525    Int tileSetTopEdgePosInCU = topLeftTile->getBottomEdgePosInCU() - topLeftTile->getTileHeight() + 1;
     3526    Int tileSetBottomEdgePosInCU = bottomRightTile->getBottomEdgePosInCU();
     3527    assert(tileSetLeftEdgePosInCU < tileSetRightEdgePosInCU && tileSetTopEdgePosInCU < tileSetBottomEdgePosInCU);
     3528    for (Int j = tileSetTopEdgePosInCU; j <= tileSetBottomEdgePosInCU; j++)
     3529    {
     3530      for (Int k = tileSetLeftEdgePosInCU; k <= tileSetRightEdgePosInCU; k++)
     3531      {
     3532        picSym->setTileSetIdxMap(j * picSym->getFrameWidthInCU() + k, i, m_pcCfg->getIlcIdc(i), false);
     3533      }
     3534    }
     3535  }
     3536 
     3537  if (m_pcCfg->getSkippedTileSetPresentFlag())
     3538  {
     3539    Int skippedTileSetIdx = m_pcCfg->getIlNumSetsInMessage();
     3540    for (Int i = 0; i < numCUs; i++)
     3541    {
     3542      if (picSym->getTileSetIdxMap(i) < 0)
     3543      {
     3544        picSym->setTileSetIdxMap(i, skippedTileSetIdx, 0, true);
     3545      }
     3546    }
     3547  }
     3548}
     3549#endif
     3550
    34503551Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices )
    34513552{
  • TabularUnified branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncGOP.h

    r431 r435  
    189189  SEIToneMappingInfo*     xCreateSEIToneMappingInfo();
    190190
     191#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     192  SEIInterLayerConstrainedTileSets* xCreateSEIInterLayerConstrainedTileSets();
     193#endif
     194
    191195  Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps);
    192196  Int xGetFirstSeiLocation (AccessUnit &accessUnit);
     
    202206    m_nestedPictureTimingSEIPresentInAU      = false;
    203207  }
     208#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     209  Void xBuildTileSetsMap(TComPicSym* picSym);
     210#endif
    204211  Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
    205212#if M0457_COL_PICTURE_SIGNALING && !REMOVE_COL_PICTURE_SIGNALING
  • TabularUnified branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r389 r435  
    32213221  Int numValidMergeCand = 0 ;
    32223222
     3223#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3224  Bool disableILP = false;
     3225  if (pcCU->getPic()->getLayerId() > 0 && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && pcCU->getPic()->getPicSym()->getTileIdxMap(pcCU->getAddr()) >= 0)
     3226  {
     3227    if (pcCU->getPic()->getPicSym()->getTileSetType(pcCU->getAddr()) == 2)
     3228    {
     3229      disableILP = true;
     3230    }
     3231    if (pcCU->getPic()->getPicSym()->getTileSetType(pcCU->getAddr()) == 1)
     3232    {
     3233      Int currCUaddr = pcCU->getAddr();
     3234      Int frameWitdhInCU  = pcCU->getPic()->getPicSym()->getFrameWidthInCU();
     3235      Int frameHeightInCU = pcCU->getPic()->getPicSym()->getFrameHeightInCU();
     3236      Bool leftCUExists   = (currCUaddr % frameWitdhInCU) > 0;
     3237      Bool aboveCUExists  = (currCUaddr / frameWitdhInCU) > 0;
     3238      Bool rightCUExists  = (currCUaddr % frameWitdhInCU) < (frameWitdhInCU - 1);
     3239      Bool belowCUExists  = (currCUaddr / frameWitdhInCU) < (frameHeightInCU - 1);
     3240      Int currTileSetIdx  = pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr);
     3241      // Check if CU is at tile set boundary
     3242      if ( (leftCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-1) != currTileSetIdx) ||
     3243           (leftCUExists && aboveCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU-1) != currTileSetIdx) ||
     3244           (aboveCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU) != currTileSetIdx) ||
     3245           (aboveCUExists && rightCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU+1) != currTileSetIdx) ||
     3246           (rightCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+1) != currTileSetIdx) ||
     3247           (rightCUExists && belowCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU+1) != currTileSetIdx) ||
     3248           (belowCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU) != currTileSetIdx) ||
     3249           (belowCUExists && leftCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU-1) != currTileSetIdx) )
     3250      {
     3251        disableILP = true;  // Disable ILP in tile set boundary CU
     3252      }
     3253    }
     3254  }
     3255#endif
     3256
    32233257  for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ )
    32243258  {
     
    32703304      for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ )
    32713305      {
     3306#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3307        if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp )->isILR(pcCU->getLayerId()) && disableILP)
     3308        {
     3309          continue;
     3310        }
     3311#endif
    32723312#if (ENCODER_FAST_MODE)
    32733313        TComPic* pcPic    = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp );
     
    34883528          testIter = false;  //the fixed part is ILR, skip this iteration       
    34893529        }
     3530#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3531        if (pcPic->isILR(pcCU->getLayerId()) && disableILP)
     3532        {
     3533          testIter = false;
     3534        }
     3535#endif
    34903536        if(testIter)
    34913537        {
     
    35033549            testRefIdx = false;  //the refined part is ILR, skip this reference pic           
    35043550          }
     3551#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3552          if (pcPic->isILR(pcCU->getLayerId()) && disableILP)
     3553          {
     3554            testRefIdx = false;
     3555          }
     3556#endif
    35053557          if(testRefIdx)
    35063558          {
Note: See TracChangeset for help on using the changeset viewer.