Ignore:
Timestamp:
2 Feb 2014, 04:51:29 (11 years ago)
Author:
seregin
Message:

update to HM-13.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r574 r593  
    44 * granted under this license. 
    55 *
    6  * Copyright (c) 2010-2013, ITU/ISO/IEC
     6 * Copyright (c) 2010-2014, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    9696  xResetNonNestedSEIPresentFlags();
    9797  xResetNestedSEIPresentFlags();
     98#if FIX1172
     99  m_associatedIRAPType = NAL_UNIT_CODED_SLICE_IDR_N_LP;
     100  m_associatedIRAPPOC  = 0;
     101#endif
    98102#if SVC_UPSAMPLING
    99103  m_pcPredSearch        = NULL;
     
    167171}
    168172
    169 #if LAYERS_NOT_PRESENT_SEI
    170 SEILayersNotPresent* TEncGOP::xCreateSEILayersNotPresent ()
    171 {
    172   UInt i = 0;
    173   SEILayersNotPresent *seiLayersNotPresent = new SEILayersNotPresent();
    174   seiLayersNotPresent->m_activeVpsId = m_pcCfg->getVPS()->getVPSId();
    175   seiLayersNotPresent->m_vpsMaxLayers = m_pcCfg->getVPS()->getMaxLayers();
    176   for ( ; i < seiLayersNotPresent->m_vpsMaxLayers; i++)
    177   {
    178     seiLayersNotPresent->m_layerNotPresentFlag[i] = true;
    179   }
    180   for ( ; i < MAX_LAYERS; i++)
    181   {
    182     seiLayersNotPresent->m_layerNotPresentFlag[i] = false;
    183   }
    184   return seiLayersNotPresent;
    185 }
    186 #endif
    187173
    188174SEIFramePacking* TEncGOP::xCreateSEIFramePacking()
     
    307293}
    308294
    309 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    310 SEIInterLayerConstrainedTileSets* 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     seiInterLayerConstrainedTileSets->m_ilNumSetsInMessageMinus1 += seiInterLayerConstrainedTileSets->m_skippedTileSetPresentFlag ? 1 : 0;
    327     for (UInt i = 0; i < m_pcCfg->getIlNumSetsInMessage(); 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 
    348295Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps)
    349296{
     
    362309    m_activeParameterSetSEIPresentInAU = true;
    363310  }
    364 
    365 #if LAYERS_NOT_PRESENT_SEI
    366   if(m_pcCfg->getLayersNotPresentSEIEnabled())
    367   {
    368     SEILayersNotPresent *sei = xCreateSEILayersNotPresent ();
    369     m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    370     m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
    371     writeRBSPTrailingBits(nalu.m_Bitstream);
    372     accessUnit.push_back(new NALUnitEBSP(nalu));
    373     delete sei;
    374   }
    375 #endif
    376311
    377312  if(m_pcCfg->getFramePackingArrangementSEIEnabled())
     
    408343    delete sei;
    409344  }
     345
     346#if SVC_EXTENSION
     347#if LAYERS_NOT_PRESENT_SEI
     348  if(m_pcCfg->getLayersNotPresentSEIEnabled())
     349  {
     350    SEILayersNotPresent *sei = xCreateSEILayersNotPresent ();
     351    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     352    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     353    writeRBSPTrailingBits(nalu.m_Bitstream);
     354    accessUnit.push_back(new NALUnitEBSP(nalu));
     355    delete sei;
     356  }
     357#endif
     358
    410359#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    411360  if(m_pcCfg->getInterLayerConstrainedTileSetsSEIEnabled())
     
    421370  }
    422371#endif
     372#endif //SVC_EXTENSION
    423373}
    424374
     
    547497#endif
    548498
    549     if( getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     499    if( getNalUnitType(pocCurr, m_iLastIDR, isField) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR, isField) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    550500    {
    551501      m_iLastIDR = pocCurr;
     
    554504    accessUnitsInGOP.push_back(AccessUnit());
    555505    AccessUnit& accessUnit = accessUnitsInGOP.back();
    556     xGetBuffer( rcListPic, rcListPicYuvRecOut, iNumPicRcvd, iTimeOffset, pcPic, pcPicYuvRecOut, pocCurr, isField );
     506    xGetBuffer( rcListPic, rcListPicYuvRecOut, iNumPicRcvd, iTimeOffset, pcPic, pcPicYuvRecOut, pocCurr, isField);
    557507
    558508    //  Slice data initialization
     
    571521    pcSlice->getPic()->setField(isField);
    572522
     523#if SVC_EXTENSION
    573524#if POC_RESET_FLAG
    574525    if( !pcSlice->getPocResetFlag() ) // For picture that are not reset, we should adjust the value of POC calculated from the configuration files.
     
    636587#endif
    637588#if O0149_CROSS_LAYER_BLA_FLAG
    638     if( m_layerId == 0 && (getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_N_LP) )
     589    if( m_layerId == 0 && (getNalUnitType(pocCurr, m_iLastIDR, isField) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR, isField) == NAL_UNIT_CODED_SLICE_IDR_N_LP) )
    639590    {
    640591      pcSlice->setCrossLayerBLAFlag(m_pcEncTop->getCrossLayerBLAFlag());
     
    693644    }
    694645#endif
     646#endif //SVC_EXTENSION
    695647
    696648    pcSlice->setLastIDR(m_iLastIDR);
     
    760712        pcSlice->setDefaultScalingList ();
    761713      }
    762 
    763714      pcSlice->getScalingList()->checkDcOfMatrix();
    764715      m_pcEncTop->getSPS()->setScalingListPresentFlag(pcSlice->checkDefaultScalingList());
     
    782733      pcSlice->setSliceType(P_SLICE);
    783734    }
     735    if(pcSlice->getSliceType()==B_SLICE&&m_pcCfg->getGOPEntry(iGOPid).m_sliceType=='I')
     736    {
     737      pcSlice->setSliceType(I_SLICE);
     738    }
     739
    784740    // Set the nal unit type
    785     pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR));
     741    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField));
    786742#if SVC_EXTENSION
    787743    if (m_layerId > 0)
     
    953909    m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid);
    954910    pcSlice->getRPS()->setNumberOfLongtermPictures(0);
     911#if FIX1172
     912    if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     913      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     914      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
     915      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     916      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP
     917      || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA )  // IRAP picture
     918    {
     919      m_associatedIRAPType = pcSlice->getNalUnitType();
     920      m_associatedIRAPPOC = pocCurr;
     921    }
     922    pcSlice->setAssociatedIRAPType(m_associatedIRAPType);
     923    pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC);
     924#endif
    955925
    956926    if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP()))
     
    960930    pcSlice->applyReferencePictureSet(rcListPic, pcSlice->getRPS());
    961931
    962     if(pcSlice->getTLayer() > 0)
     932    if(pcSlice->getTLayer() > 0
     933      &&  !( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N     // Check if not a leading picture
     934          || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R
     935          || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N
     936          || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R )
     937        )
    963938    {
    964939      if(pcSlice->isTemporalLayerSwitchingPoint(rcListPic) || pcSlice->getSPS()->getTemporalIdNestingFlag())
     
    16331608
    16341609    // SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
    1635 #if HM_CLEANUP_SAO
    16361610    if( pcSlice->getSPS()->getUseSAO() && m_pcCfg->getSaoLcuBoundary() )
    16371611    {
    16381612      m_pcSAO->getPreDBFStatistics(pcPic);
    16391613    }
    1640 #else
    1641     if( m_pcCfg->getSaoLcuBasedOptimization() && m_pcCfg->getSaoLcuBoundary() )
    1642     {
    1643       m_pcSAO->resetStats();
    1644       m_pcSAO->calcSaoStatsCu_BeforeDblk( pcPic );
    1645     }
    1646 #endif   
    16471614    //-- Loop filter
    16481615    Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag();
     
    16541621    m_pcLoopFilter->loopFilterPic( pcPic );
    16551622
    1656 #if !HM_CLEANUP_SAO   
    1657     pcSlice = pcPic->getSlice(0);
    1658     if(pcSlice->getSPS()->getUseSAO())
    1659     {
    1660       std::vector<Bool> LFCrossSliceBoundaryFlag;
    1661       for(Int s=0; s< uiNumSlices; s++)
    1662       {
    1663         LFCrossSliceBoundaryFlag.push_back(  ((uiNumSlices==1)?true:pcPic->getSlice(s)->getLFCrossSliceBoundaryFlag()) );
    1664       }
    1665       m_storedStartCUAddrForEncodingSlice.resize(uiNumSlices+1);
    1666       pcPic->createNonDBFilterInfo(m_storedStartCUAddrForEncodingSlice, 0, &LFCrossSliceBoundaryFlag ,pcPic->getPicSym()->getNumTiles() ,bLFCrossTileBoundary);
    1667     }
    1668 
    1669 
    1670     pcSlice = pcPic->getSlice(0);
    1671 
    1672     if(pcSlice->getSPS()->getUseSAO())
    1673     {
    1674       m_pcSAO->createPicSaoInfo(pcPic);
    1675     }
    1676 #endif
    16771623    /////////////////////////////////////////////////////////////////////////////////////////////////// File writing
    16781624    // Set entropy coder
     
    17921738        {
    17931739          SOPcurrPOC += deltaPOC;
    1794           SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR);
     1740          SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR, isField);
    17951741          SOPDescriptionSEI.m_sopDescTemporalId[i] = m_pcCfg->getGOPEntry(j).m_temporalId;
    17961742          SOPDescriptionSEI.m_sopDescStRpsIdx[i] = m_pcEncTop->getReferencePictureSetIdxForSOP(pcSlice, SOPcurrPOC, j);
     
    22572203              m_pcEntropyCoder->resetEntropy();
    22582204              m_pcEntropyCoder->setBitstream( m_pcBitCounter );
    2259 #if HM_CLEANUP_SAO
    22602205              Bool sliceEnabled[NUM_SAO_COMPONENTS];
    22612206              m_pcSAO->initRDOCabacCoder(m_pcEncTop->getRDGoOnSbacCoder(), pcSlice);
     
    22762221                pcPic->getSlice(s)->setSaoEnabledFlagChroma(sliceEnabled[SAO_Cb]);
    22772222              }
    2278 #else
    2279               m_pcSAO->startSaoEnc(pcPic, m_pcEntropyCoder, m_pcEncTop->getRDSbacCoder(), m_pcEncTop->getRDGoOnSbacCoder());
    2280               SAOParam& cSaoParam = *pcSlice->getPic()->getPicSym()->getSaoParam();
    2281 
    2282 #if SAO_ENCODING_CHOICE
    2283               m_pcSAO->SAOProcess(&cSaoParam, pcPic->getSlice(0)->getLambdas()[TEXT_LUMA], pcPic->getSlice(0)->getLambdas()[TEXT_CHROMA], pcPic->getSlice(0)->getDepth());
    2284 #else
    2285               m_pcSAO->SAOProcess(&cSaoParam, pcPic->getSlice(0)->getLambdaLuma(), pcPic->getSlice(0)->getLambdaChroma());
    2286 #endif
    2287               m_pcSAO->endSaoEnc();
    2288               m_pcSAO->PCMLFDisableProcess(pcPic);
    2289 #endif
    22902223            }
    2291 #if !HM_CLEANUP_SAO         
    2292 #if SAO_RDO
    2293             m_pcEntropyCoder->setEntropyCoder ( m_pcCavlcCoder, pcSlice );
    2294 #endif
    2295 #endif
    22962224            processingState = ENCODE_SLICE;
    2297 #if !HM_CLEANUP_SAO
    2298 #if HIGHER_LAYER_IRAP_SKIP_FLAG
    2299             if ( ( m_pcEncTop->getSkipPictureAtArcSwitch() && m_pcEncTop->getAdaptiveResolutionChange() > 0 && pcSlice->getLayerId() == 1 && pcSlice->getPOC() == m_pcEncTop->getAdaptiveResolutionChange()) )
    2300             {
    2301               pcSlice->getPic()->getPicSym()->getSaoParam()->bSaoFlag[0]=0;
    2302               pcSlice->getPic()->getPicSym()->getSaoParam()->bSaoFlag[1]=0;
    2303             }
    2304 #endif
    2305             for(Int s=0; s< uiNumSlices; s++)
    2306             {
    2307               if (pcSlice->getSPS()->getUseSAO())
    2308               {
    2309                 pcPic->getSlice(s)->setSaoEnabledFlag((pcSlice->getPic()->getPicSym()->getSaoParam()->bSaoFlag[0]==1)?true:false);
    2310               }
    2311             }
    2312 #endif
    23132225          }
    23142226          break;
     
    23212233        }
    23222234      } // end iteration over slices
    2323 #if !HM_CLEANUP_SAO   
    2324       if(pcSlice->getSPS()->getUseSAO())
    2325       {
    2326         if(pcSlice->getSPS()->getUseSAO())
    2327         {
    2328           m_pcSAO->destroyPicSaoInfo();
    2329         }
    2330         pcPic->destroyNonDBFilterInfo();
    2331       }
    2332 #endif
    23332235      pcPic->compressMotion();
    23342236     
     
    24022304
    24032305      //In case of field coding, compute the interlaced PSNR for both fields
    2404       if (isField && ((!pcPic->isTopField() && isTff) || (pcPic->isTopField() && !isTff)))
     2306    if (isField && ((!pcPic->isTopField() && isTff) || (pcPic->isTopField() && !isTff)) && (pcPic->getPOC()%m_iGopSize != 1))
    24052307      {
    24062308        //get complementary top field
     
    24142316        xCalculateInterlacedAddPSNR(pcPicTop, pcPic, pcPicTop->getPicYuvRec(), pcPic->getPicYuvRec(), accessUnit, dEncTime );
    24152317      }
     2318    else if (isField && pcPic->getPOC()!= 0 && (pcPic->getPOC()%m_iGopSize == 0))
     2319    {
     2320      //get complementary bottom field
     2321      TComPic* pcPicBottom;
     2322      TComList<TComPic*>::iterator   iterPic = rcListPic.begin();
     2323      while ((*iterPic)->getPOC() != pcPic->getPOC()+1)
     2324      {
     2325        iterPic ++;
     2326      }
     2327      pcPicBottom = *(iterPic);
     2328      xCalculateInterlacedAddPSNR(pcPic, pcPicBottom, pcPic->getPicYuvRec(), pcPicBottom->getPicYuvRec(), accessUnit, dEncTime );
     2329    }
    24162330
    24172331      if (digestStr)
     
    27172631  m_pcEntropyCoder->resetEntropy    ();
    27182632  m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
    2719 #if !HM_CLEANUP_SAO
    2720   pcSlice = pcPic->getSlice(0);
    2721   if(pcSlice->getSPS()->getUseSAO())
    2722   {
    2723     std::vector<Bool> LFCrossSliceBoundaryFlag(1, true);
    2724     std::vector<Int>  sliceStartAddress;
    2725     sliceStartAddress.push_back(0);
    2726     sliceStartAddress.push_back(pcPic->getNumCUsInFrame()* pcPic->getNumPartInCU());
    2727     pcPic->createNonDBFilterInfo(sliceStartAddress, 0, &LFCrossSliceBoundaryFlag);
    2728   }
    2729  
    2730   if( pcSlice->getSPS()->getUseSAO())
    2731   {
    2732     pcPic->destroyNonDBFilterInfo();
    2733   }
    2734 #endif
    27352633  m_pcEntropyCoder->resetEntropy    ();
    27362634  ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits();
     
    33033201 * This function checks the configuration and returns the appropriate nal_unit_type for the picture.
    33043202 */
    3305 NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR)
     3203NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR, Bool isField)
    33063204{
    33073205  if (pocCurr == 0)
     
    33093207    return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
    33103208  }
    3311   if (pocCurr % m_pcCfg->getIntraPeriod() == 0)
     3209  if ((pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0)
    33123210  {
    33133211    if (m_pcCfg->getDecodingRefreshType() == 1)
     
    35323430  return seiStartPos;
    35333431}
    3534 
    3535 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3536 Void TEncGOP::xBuildTileSetsMap(TComPicSym* picSym)
    3537 {
    3538   Int numCUs = picSym->getFrameWidthInCU() * picSym->getFrameHeightInCU();
    3539 
    3540   for (Int i = 0; i < numCUs; i++)
    3541   {
    3542     picSym->setTileSetIdxMap(i, -1, 0, false);
    3543   }
    3544 
    3545   for (Int i = 0; i < m_pcCfg->getIlNumSetsInMessage(); i++)
    3546   {
    3547     TComTile* topLeftTile     = picSym->getTComTile(m_pcCfg->getTopLeftTileIndex(i));
    3548     TComTile* bottomRightTile = picSym->getTComTile(m_pcCfg->getBottomRightTileIndex(i));
    3549     Int tileSetLeftEdgePosInCU = topLeftTile->getRightEdgePosInCU() - topLeftTile->getTileWidth() + 1;
    3550     Int tileSetRightEdgePosInCU = bottomRightTile->getRightEdgePosInCU();
    3551     Int tileSetTopEdgePosInCU = topLeftTile->getBottomEdgePosInCU() - topLeftTile->getTileHeight() + 1;
    3552     Int tileSetBottomEdgePosInCU = bottomRightTile->getBottomEdgePosInCU();
    3553     assert(tileSetLeftEdgePosInCU < tileSetRightEdgePosInCU && tileSetTopEdgePosInCU < tileSetBottomEdgePosInCU);
    3554     for (Int j = tileSetTopEdgePosInCU; j <= tileSetBottomEdgePosInCU; j++)
    3555     {
    3556       for (Int k = tileSetLeftEdgePosInCU; k <= tileSetRightEdgePosInCU; k++)
    3557       {
    3558         picSym->setTileSetIdxMap(j * picSym->getFrameWidthInCU() + k, i, m_pcCfg->getIlcIdc(i), false);
    3559       }
    3560     }
    3561   }
    3562  
    3563   if (m_pcCfg->getSkippedTileSetPresentFlag())
    3564   {
    3565     Int skippedTileSetIdx = m_pcCfg->getIlNumSetsInMessage();
    3566     for (Int i = 0; i < numCUs; i++)
    3567     {
    3568       if (picSym->getTileSetIdxMap(i) < 0)
    3569       {
    3570         picSym->setTileSetIdxMap(i, skippedTileSetIdx, 0, true);
    3571       }
    3572     }
    3573   }
    3574 }
    3575 #endif
    35763432
    35773433Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices )
     
    36983554  free(rowSAD);
    36993555}
     3556#if SVC_EXTENSION
     3557#if LAYERS_NOT_PRESENT_SEI
     3558SEILayersNotPresent* TEncGOP::xCreateSEILayersNotPresent ()
     3559{
     3560  UInt i = 0;
     3561  SEILayersNotPresent *seiLayersNotPresent = new SEILayersNotPresent();
     3562  seiLayersNotPresent->m_activeVpsId = m_pcCfg->getVPS()->getVPSId();
     3563  seiLayersNotPresent->m_vpsMaxLayers = m_pcCfg->getVPS()->getMaxLayers();
     3564  for ( ; i < seiLayersNotPresent->m_vpsMaxLayers; i++)
     3565  {
     3566    seiLayersNotPresent->m_layerNotPresentFlag[i] = true;
     3567  }
     3568  for ( ; i < MAX_LAYERS; i++)
     3569  {
     3570    seiLayersNotPresent->m_layerNotPresentFlag[i] = false;
     3571  }
     3572  return seiLayersNotPresent;
     3573}
     3574#endif
     3575
     3576#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3577SEIInterLayerConstrainedTileSets* TEncGOP::xCreateSEIInterLayerConstrainedTileSets()
     3578{
     3579  SEIInterLayerConstrainedTileSets *seiInterLayerConstrainedTileSets = new SEIInterLayerConstrainedTileSets();
     3580  seiInterLayerConstrainedTileSets->m_ilAllTilesExactSampleValueMatchFlag = false;
     3581  seiInterLayerConstrainedTileSets->m_ilOneTilePerTileSetFlag = false;
     3582  if (!seiInterLayerConstrainedTileSets->m_ilOneTilePerTileSetFlag)
     3583  {
     3584    seiInterLayerConstrainedTileSets->m_ilNumSetsInMessageMinus1 = m_pcCfg->getIlNumSetsInMessage() - 1;
     3585    if (seiInterLayerConstrainedTileSets->m_ilNumSetsInMessageMinus1)
     3586    {
     3587      seiInterLayerConstrainedTileSets->m_skippedTileSetPresentFlag = m_pcCfg->getSkippedTileSetPresentFlag();
     3588    }
     3589    else
     3590    {
     3591      seiInterLayerConstrainedTileSets->m_skippedTileSetPresentFlag = false;
     3592    }
     3593    seiInterLayerConstrainedTileSets->m_ilNumSetsInMessageMinus1 += seiInterLayerConstrainedTileSets->m_skippedTileSetPresentFlag ? 1 : 0;
     3594    for (UInt i = 0; i < m_pcCfg->getIlNumSetsInMessage(); i++)
     3595    {
     3596      seiInterLayerConstrainedTileSets->m_ilctsId[i] = i;
     3597      seiInterLayerConstrainedTileSets->m_ilNumTileRectsInSetMinus1[i] = 0;
     3598      for( UInt j = 0; j <= seiInterLayerConstrainedTileSets->m_ilNumTileRectsInSetMinus1[i]; j++)
     3599      {
     3600        seiInterLayerConstrainedTileSets->m_ilTopLeftTileIndex[i][j]     = m_pcCfg->getTopLeftTileIndex(i);
     3601        seiInterLayerConstrainedTileSets->m_ilBottomRightTileIndex[i][j] = m_pcCfg->getBottomRightTileIndex(i);
     3602      }
     3603      seiInterLayerConstrainedTileSets->m_ilcIdc[i] = m_pcCfg->getIlcIdc(i);
     3604      if (seiInterLayerConstrainedTileSets->m_ilAllTilesExactSampleValueMatchFlag)
     3605      {
     3606        seiInterLayerConstrainedTileSets->m_ilExactSampleValueMatchFlag[i] = false;
     3607      }
     3608    }
     3609  }
     3610
     3611  return seiInterLayerConstrainedTileSets;
     3612}
     3613
     3614Void TEncGOP::xBuildTileSetsMap(TComPicSym* picSym)
     3615{
     3616  Int numCUs = picSym->getFrameWidthInCU() * picSym->getFrameHeightInCU();
     3617
     3618  for (Int i = 0; i < numCUs; i++)
     3619  {
     3620    picSym->setTileSetIdxMap(i, -1, 0, false);
     3621  }
     3622
     3623  for (Int i = 0; i < m_pcCfg->getIlNumSetsInMessage(); i++)
     3624  {
     3625    TComTile* topLeftTile     = picSym->getTComTile(m_pcCfg->getTopLeftTileIndex(i));
     3626    TComTile* bottomRightTile = picSym->getTComTile(m_pcCfg->getBottomRightTileIndex(i));
     3627    Int tileSetLeftEdgePosInCU = topLeftTile->getRightEdgePosInCU() - topLeftTile->getTileWidth() + 1;
     3628    Int tileSetRightEdgePosInCU = bottomRightTile->getRightEdgePosInCU();
     3629    Int tileSetTopEdgePosInCU = topLeftTile->getBottomEdgePosInCU() - topLeftTile->getTileHeight() + 1;
     3630    Int tileSetBottomEdgePosInCU = bottomRightTile->getBottomEdgePosInCU();
     3631    assert(tileSetLeftEdgePosInCU < tileSetRightEdgePosInCU && tileSetTopEdgePosInCU < tileSetBottomEdgePosInCU);
     3632    for (Int j = tileSetTopEdgePosInCU; j <= tileSetBottomEdgePosInCU; j++)
     3633    {
     3634      for (Int k = tileSetLeftEdgePosInCU; k <= tileSetRightEdgePosInCU; k++)
     3635      {
     3636        picSym->setTileSetIdxMap(j * picSym->getFrameWidthInCU() + k, i, m_pcCfg->getIlcIdc(i), false);
     3637      }
     3638    }
     3639  }
     3640 
     3641  if (m_pcCfg->getSkippedTileSetPresentFlag())
     3642  {
     3643    Int skippedTileSetIdx = m_pcCfg->getIlNumSetsInMessage();
     3644    for (Int i = 0; i < numCUs; i++)
     3645    {
     3646      if (picSym->getTileSetIdxMap(i) < 0)
     3647      {
     3648        picSym->setTileSetIdxMap(i, skippedTileSetIdx, 0, true);
     3649      }
     3650    }
     3651  }
     3652}
     3653#endif
     3654#endif //SVC_EXTENSION
     3655
    37003656//! \}
Note: See TracChangeset for help on using the changeset viewer.