Changeset 593 in SHVCSoftware for branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp
- Timestamp:
- 2 Feb 2014, 04:51:29 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r574 r593 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 3, ITU/ISO/IEC6 * Copyright (c) 2010-2014, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 96 96 xResetNonNestedSEIPresentFlags(); 97 97 xResetNestedSEIPresentFlags(); 98 #if FIX1172 99 m_associatedIRAPType = NAL_UNIT_CODED_SLICE_IDR_N_LP; 100 m_associatedIRAPPOC = 0; 101 #endif 98 102 #if SVC_UPSAMPLING 99 103 m_pcPredSearch = NULL; … … 167 171 } 168 172 169 #if LAYERS_NOT_PRESENT_SEI170 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 #endif187 173 188 174 SEIFramePacking* TEncGOP::xCreateSEIFramePacking() … … 307 293 } 308 294 309 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI310 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 else323 {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 #endif347 348 295 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps) 349 296 { … … 362 309 m_activeParameterSetSEIPresentInAU = true; 363 310 } 364 365 #if LAYERS_NOT_PRESENT_SEI366 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 #endif376 311 377 312 if(m_pcCfg->getFramePackingArrangementSEIEnabled()) … … 408 343 delete sei; 409 344 } 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 410 359 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 411 360 if(m_pcCfg->getInterLayerConstrainedTileSetsSEIEnabled()) … … 421 370 } 422 371 #endif 372 #endif //SVC_EXTENSION 423 373 } 424 374 … … 547 497 #endif 548 498 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 ) 550 500 { 551 501 m_iLastIDR = pocCurr; … … 554 504 accessUnitsInGOP.push_back(AccessUnit()); 555 505 AccessUnit& accessUnit = accessUnitsInGOP.back(); 556 xGetBuffer( rcListPic, rcListPicYuvRecOut, iNumPicRcvd, iTimeOffset, pcPic, pcPicYuvRecOut, pocCurr, isField 506 xGetBuffer( rcListPic, rcListPicYuvRecOut, iNumPicRcvd, iTimeOffset, pcPic, pcPicYuvRecOut, pocCurr, isField); 557 507 558 508 // Slice data initialization … … 571 521 pcSlice->getPic()->setField(isField); 572 522 523 #if SVC_EXTENSION 573 524 #if POC_RESET_FLAG 574 525 if( !pcSlice->getPocResetFlag() ) // For picture that are not reset, we should adjust the value of POC calculated from the configuration files. … … 636 587 #endif 637 588 #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) ) 639 590 { 640 591 pcSlice->setCrossLayerBLAFlag(m_pcEncTop->getCrossLayerBLAFlag()); … … 693 644 } 694 645 #endif 646 #endif //SVC_EXTENSION 695 647 696 648 pcSlice->setLastIDR(m_iLastIDR); … … 760 712 pcSlice->setDefaultScalingList (); 761 713 } 762 763 714 pcSlice->getScalingList()->checkDcOfMatrix(); 764 715 m_pcEncTop->getSPS()->setScalingListPresentFlag(pcSlice->checkDefaultScalingList()); … … 782 733 pcSlice->setSliceType(P_SLICE); 783 734 } 735 if(pcSlice->getSliceType()==B_SLICE&&m_pcCfg->getGOPEntry(iGOPid).m_sliceType=='I') 736 { 737 pcSlice->setSliceType(I_SLICE); 738 } 739 784 740 // Set the nal unit type 785 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR ));741 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField)); 786 742 #if SVC_EXTENSION 787 743 if (m_layerId > 0) … … 953 909 m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid); 954 910 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 955 925 956 926 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP())) … … 960 930 pcSlice->applyReferencePictureSet(rcListPic, pcSlice->getRPS()); 961 931 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 ) 963 938 { 964 939 if(pcSlice->isTemporalLayerSwitchingPoint(rcListPic) || pcSlice->getSPS()->getTemporalIdNestingFlag()) … … 1633 1608 1634 1609 // SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas 1635 #if HM_CLEANUP_SAO1636 1610 if( pcSlice->getSPS()->getUseSAO() && m_pcCfg->getSaoLcuBoundary() ) 1637 1611 { 1638 1612 m_pcSAO->getPreDBFStatistics(pcPic); 1639 1613 } 1640 #else1641 if( m_pcCfg->getSaoLcuBasedOptimization() && m_pcCfg->getSaoLcuBoundary() )1642 {1643 m_pcSAO->resetStats();1644 m_pcSAO->calcSaoStatsCu_BeforeDblk( pcPic );1645 }1646 #endif1647 1614 //-- Loop filter 1648 1615 Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); … … 1654 1621 m_pcLoopFilter->loopFilterPic( pcPic ); 1655 1622 1656 #if !HM_CLEANUP_SAO1657 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 #endif1677 1623 /////////////////////////////////////////////////////////////////////////////////////////////////// File writing 1678 1624 // Set entropy coder … … 1792 1738 { 1793 1739 SOPcurrPOC += deltaPOC; 1794 SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR );1740 SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR, isField); 1795 1741 SOPDescriptionSEI.m_sopDescTemporalId[i] = m_pcCfg->getGOPEntry(j).m_temporalId; 1796 1742 SOPDescriptionSEI.m_sopDescStRpsIdx[i] = m_pcEncTop->getReferencePictureSetIdxForSOP(pcSlice, SOPcurrPOC, j); … … 2257 2203 m_pcEntropyCoder->resetEntropy(); 2258 2204 m_pcEntropyCoder->setBitstream( m_pcBitCounter ); 2259 #if HM_CLEANUP_SAO2260 2205 Bool sliceEnabled[NUM_SAO_COMPONENTS]; 2261 2206 m_pcSAO->initRDOCabacCoder(m_pcEncTop->getRDGoOnSbacCoder(), pcSlice); … … 2276 2221 pcPic->getSlice(s)->setSaoEnabledFlagChroma(sliceEnabled[SAO_Cb]); 2277 2222 } 2278 #else2279 m_pcSAO->startSaoEnc(pcPic, m_pcEntropyCoder, m_pcEncTop->getRDSbacCoder(), m_pcEncTop->getRDGoOnSbacCoder());2280 SAOParam& cSaoParam = *pcSlice->getPic()->getPicSym()->getSaoParam();2281 2282 #if SAO_ENCODING_CHOICE2283 m_pcSAO->SAOProcess(&cSaoParam, pcPic->getSlice(0)->getLambdas()[TEXT_LUMA], pcPic->getSlice(0)->getLambdas()[TEXT_CHROMA], pcPic->getSlice(0)->getDepth());2284 #else2285 m_pcSAO->SAOProcess(&cSaoParam, pcPic->getSlice(0)->getLambdaLuma(), pcPic->getSlice(0)->getLambdaChroma());2286 #endif2287 m_pcSAO->endSaoEnc();2288 m_pcSAO->PCMLFDisableProcess(pcPic);2289 #endif2290 2223 } 2291 #if !HM_CLEANUP_SAO2292 #if SAO_RDO2293 m_pcEntropyCoder->setEntropyCoder ( m_pcCavlcCoder, pcSlice );2294 #endif2295 #endif2296 2224 processingState = ENCODE_SLICE; 2297 #if !HM_CLEANUP_SAO2298 #if HIGHER_LAYER_IRAP_SKIP_FLAG2299 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 #endif2305 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 #endif2313 2225 } 2314 2226 break; … … 2321 2233 } 2322 2234 } // end iteration over slices 2323 #if !HM_CLEANUP_SAO2324 if(pcSlice->getSPS()->getUseSAO())2325 {2326 if(pcSlice->getSPS()->getUseSAO())2327 {2328 m_pcSAO->destroyPicSaoInfo();2329 }2330 pcPic->destroyNonDBFilterInfo();2331 }2332 #endif2333 2235 pcPic->compressMotion(); 2334 2236 … … 2402 2304 2403 2305 //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)) 2405 2307 { 2406 2308 //get complementary top field … … 2414 2316 xCalculateInterlacedAddPSNR(pcPicTop, pcPic, pcPicTop->getPicYuvRec(), pcPic->getPicYuvRec(), accessUnit, dEncTime ); 2415 2317 } 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 } 2416 2330 2417 2331 if (digestStr) … … 2717 2631 m_pcEntropyCoder->resetEntropy (); 2718 2632 m_pcEntropyCoder->setBitstream ( m_pcBitCounter ); 2719 #if !HM_CLEANUP_SAO2720 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 #endif2735 2633 m_pcEntropyCoder->resetEntropy (); 2736 2634 ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits(); … … 3303 3201 * This function checks the configuration and returns the appropriate nal_unit_type for the picture. 3304 3202 */ 3305 NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR )3203 NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR, Bool isField) 3306 3204 { 3307 3205 if (pocCurr == 0) … … 3309 3207 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 3310 3208 } 3311 if ( pocCurr% m_pcCfg->getIntraPeriod() == 0)3209 if ((pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0) 3312 3210 { 3313 3211 if (m_pcCfg->getDecodingRefreshType() == 1) … … 3532 3430 return seiStartPos; 3533 3431 } 3534 3535 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI3536 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 #endif3576 3432 3577 3433 Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices ) … … 3698 3554 free(rowSAD); 3699 3555 } 3556 #if SVC_EXTENSION 3557 #if LAYERS_NOT_PRESENT_SEI 3558 SEILayersNotPresent* 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 3577 SEIInterLayerConstrainedTileSets* 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 3614 Void 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 3700 3656 //! \}
Note: See TracChangeset for help on using the changeset viewer.